{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/ben/.local/lib/python3.6/site-packages/pandas/compat/_optional.py:106: UserWarning: Pandas requires version '1.2.1' or newer of 'bottleneck' (version '1.2.0' currently installed).\n",
      "  warnings.warn(msg, UserWarning)\n"
     ]
    }
   ],
   "source": [
    "import pointCollection as pc\n",
    "import numpy as np\n",
    "import scipy.stats as ss\n",
    "import matplotlib.pyplot as plt\n",
    "import h5py\n",
    "%matplotlib notebook\n",
    "import scipy.interpolate as si\n",
    "import scipy.stats as ss\n",
    "import h5py\n",
    "import os\n",
    "import re\n",
    "import matplotlib.gridspec as gridspec\n",
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "\n",
    "# change this data root to match your own\n",
    "data_root = '/Volumes/ice2/ben/MAR/ATL11_with_corrections/'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "drainage_basins=pc.grid.data().from_geotif(data_root+'/drainage_basins.tif')\n",
    "gimp_mask=pc.grid.data().from_geotif(data_root+'/GimpIceMask_1km.tif')\n",
    "v_mask=pc.grid.data().from_geotif(data_root+'/vel_mask_annual_sigma_lt_20.tif')\n",
    "v_mask.index(np.arange(0, v_mask.shape[0], 5), np.arange(0, v_mask.shape[1], 5));\n",
    "dbi=si.RegularGridInterpolator((drainage_basins.y, drainage_basins.x), drainage_basins.z, method='nearest')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "def RDE(x):\n",
    "    xs=x.copy()\n",
    "    xs=np.isfinite(xs)   # this changes xs from values to a boolean\n",
    "    N=len(xs.nonzero()[0])\n",
    "    if N<2 :\n",
    "        return np.nan\n",
    "    ind=np.arange(0.5, N)\n",
    "    LH=np.interp(np.array([0.16, 0.84])*N, ind, np.sort(x[xs]))\n",
    "    #print('LH =',LH)\n",
    "    return (LH[1]-LH[0])/2.  # trying to get some kind of a width of the data ~variance\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## read in the data file.  \n",
    "The data were written by the 'reduce_firn_dh' notebook.  It contains one top-level group for each model, and beneath that, one group for each epoch.  Within each epoch, the data represent a 2.5-km blockmedian of the corrected elevation-change values.  This gives a smaller number of difference values for each region, and makes a file of reasonable size.\n",
    "\n",
    "Applying the blockmedian to the drainage basin variable didn't work well (cells containing borders aren't represented well), so let's repeat the interpolation for the cell locations."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['GSFC_fdm_v1_zsurf', 'MARv3_11_2_ERA_10km_zsurf', 'MARv3_11_2_ERA_20km_zsurf', 'MARv3_11_2_NCEP_20km_zsurf', 'MARv3_11_ERA_zsurf']\n"
     ]
    }
   ],
   "source": [
    "data_file=os.path.join(data_root+'/combined_xover_at_differences.h5')\n",
    "\n",
    "\n",
    "strings_xover = ['2018.Q4-2019.Q2','2019.Q1-2019.Q2']\n",
    "strings_at=['2019.Q2-2019.Q3', '2019.Q3-2019.Q4', '2019.Q4-2020.Q1']\n",
    "epochs=strings_xover+strings_at\n",
    "\n",
    "D={}\n",
    "with h5py.File(data_file,'r') as h5f:\n",
    "    models=list(h5f.keys())\n",
    "    print(models)\n",
    "for model in models:\n",
    "    D[model]={}\n",
    "    for epoch in epochs:\n",
    "        this_group='/'.join(['',model, epoch])\n",
    "        D[model][epoch]=pc.data().from_h5(data_file, group=this_group)\n",
    "        D[model][epoch].assign({'basin':np.floor(dbi.__call__((D[model][epoch].y, D[model][epoch].x))*10)/10})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<class 'pointCollection.data.data'> with shape (15683,),\n",
       "with fields:\n",
       "['basin', 'dh', 'dh_corr', 'h0', 't0', 't1', 'x', 'y']"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "D[model][epoch]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Calculate the percentiles for all models and for all epochs\n",
    "We'll save the percentiles of the elevation differences for all the models to look at collectively"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "h_ranges=[(-10, 2000), (2000, 5000)]\n",
    "h_range_cols={h_ranges[0]:0, h_ranges[1]:1}\n",
    "h_range_colors={h_ranges[0]:'r', h_ranges[1]:'g'}\n",
    "h_range_names=['< 2000', '> 2000']\n",
    "\n",
    "basins=np.arange(1,9)\n",
    "\n",
    "percentiles=np.array([5, 16, 50, 84, 95])\n",
    "pct={epoch :\\\n",
    "     {model:\\\n",
    "      {h_range:\\\n",
    "       {rc:np.zeros((basins.size, percentiles.size)) for rc in ['raw', 'corr']}\\\n",
    "       for h_range in h_ranges}\\\n",
    "      for model in models}\n",
    "     for epoch in epochs + ['melt', 'non_melt', 'all']}\n",
    "\n",
    "for count, model in enumerate(models):\n",
    "    for epoch in epochs +['melt', 'non_melt','all']:\n",
    "        for h_range in h_ranges:\n",
    "            pct[epoch][model][h_range]['count']=np.zeros(basins.size)\n",
    "\n",
    "for count, model in enumerate(models): \n",
    "    for epoch in epochs:\n",
    "        for basin in basins:\n",
    "            for h_range in h_ranges: \n",
    "                Dsub=D[model][epoch]\n",
    "                els = np.floor(Dsub.basin)==basin\n",
    "                els &= (Dsub.h0 > h_range[0])\n",
    "                els &= (Dsub.h0 < h_range[1])\n",
    "                Dsub=Dsub[els]\n",
    "                pct[epoch][model][h_range]['raw'][basin-1,:]=ss.scoreatpercentile(Dsub.dh, percentiles)\n",
    "                pct[epoch][model][h_range]['corr'][basin-1,:]=ss.scoreatpercentile(Dsub.dh_corr, percentiles)\n",
    "                pct[epoch][model][h_range]['count'][basin-1]=Dsub.size"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "# melt season runs May 15 -> August 1  (May begins 4*30 days into the new year, 2019 starts ~day 365.25)\n",
    "melt_season=np.array([365.25+4*30+15, 365.25+7*30])*3600*24\n",
    "\n",
    "for count, model in enumerate(models): \n",
    "    for basin in basins:\n",
    "        for h_range in h_ranges: \n",
    "            melt_data=[]\n",
    "            non_melt_data=[]\n",
    "            all_data=[]\n",
    "            for epoch in epochs:\n",
    "                Dsub=D[model][epoch]\n",
    "                els = np.floor(Dsub.basin)==basin\n",
    "                els &= (Dsub.h0 > h_range[0])\n",
    "                els &= (Dsub.h0 < h_range[1])\n",
    "                Dsub=Dsub[els]\n",
    "                melt_days = ( ((Dsub.t0 < melt_season[0] ) & (Dsub.t1 > melt_season[0]) ) *(Dsub.t1-melt_season[0]) + \\\n",
    "                ((Dsub.t0 > melt_season[0] ) & (Dsub.t1 < melt_season[1]) )*(Dsub.t1-Dsub.t0) + \\\n",
    "                ((Dsub.t1 > melt_season[0] ) & (Dsub.t1 < melt_season[1]) ) *(melt_season[1]-Dsub.t1) )/24/3600.\n",
    "                melt_data += [Dsub[melt_days>40]]\n",
    "                non_melt_data += [Dsub[melt_days < 7 ]]\n",
    "                all_data += [Dsub]\n",
    "            temp=pc.data().from_list(melt_data)\n",
    "            pct['melt'][model][h_range]['raw'][basin-1,:] = ss.scoreatpercentile(temp.dh, percentiles)\n",
    "            pct['melt'][model][h_range]['corr'][basin-1,:] = ss.scoreatpercentile(temp.dh_corr, percentiles)\n",
    "            pct['melt'][model][h_range]['count'][basin-1]=temp.size\n",
    "            temp=pc.data().from_list(non_melt_data)\n",
    "            pct['non_melt'][model][h_range]['raw'][basin-1,:] = ss.scoreatpercentile(temp.dh, percentiles)\n",
    "            pct['non_melt'][model][h_range]['corr'][basin-1,:] = ss.scoreatpercentile(temp.dh_corr, percentiles)\n",
    "            pct['non_melt'][model][h_range]['count'][basin-1]=temp.size\n",
    "            temp=pc.data().from_list(all_data)\n",
    "            pct['all'][model][h_range]['raw'][basin-1,:] = ss.scoreatpercentile(temp.dh, percentiles)\n",
    "            pct['all'][model][h_range]['corr'][basin-1,:] = ss.scoreatpercentile(temp.dh_corr, percentiles)\n",
    "            pct['all'][model][h_range]['count'][basin-1]=temp.size"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{1: 0.3870482390149538,\n",
       " 2: 0.3145705454703757,\n",
       " 3: 0.2680590768240171,\n",
       " 4: 0.19734710409072498,\n",
       " 5: 0.16221628838451269,\n",
       " 6: 0.32421182455869885,\n",
       " 7: 0.2914984472049689,\n",
       " 8: 0.3209974364949895}"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "{basin:pct['melt'][model][h_ranges[1]]['count'][basin-1]/pct['non_melt'][model][h_ranges[1]]['count'][basin-1] for basin in basins}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Tables of statistics:\n",
    "This function reports a summary of a particular statistic for the different models."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "#sn={'raw':'raw',\n",
    "#        'GSFC_fdm_v1_zsurf':'GSFC_v1',\n",
    "#        'MARv3_11_ERA_zsurf':'M3.11ERA.15', \n",
    "#        'MARv3_11_2_ERA_10km_zsurf':'M3.11.2ERA10',\n",
    "#        'MARv3_11_2_ERA_20km_zsurf':'M3.11.2ERA20',\n",
    "#        'MARv3_11_2_NCEP_20km_zsurf':'M311.2NC20'\n",
    "#        ''}\n",
    "sn={'raw':'raw',\n",
    "        'GSFC_fdm_v1_zsurf':'GSFC_v1',\n",
    "#        'MARv3_11_ERA_zsurf':'M3.11ERA.15', \n",
    "        'MARv3_11_2_ERA_10km_zsurf':'M3.11.2ERA10',\n",
    "#        'MARv3_11_2_ERA_20km_zsurf':'M3.11.2ERA20',\n",
    "       'MARv3_11_2_NCEP_20km_zsurf':'M311.2NC20'\n",
    "        ''}\n",
    "\n",
    "\n",
    "sigma_sn={model:f'$\\sigma_{{{sn[model]}}}$' for model in sn.keys()}\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "def all_basin_stats(pct, epoch, h_range, var):\n",
    "    if var=='lt_tail':\n",
    "        p1=1\n",
    "        p0=0\n",
    "    elif var == 'ctr':\n",
    "        p1=3\n",
    "        p0=1\n",
    "    elif var == 'rt_tail':\n",
    "        p1=4\n",
    "        p0=3\n",
    "\n",
    "    #models=['GSFC_fdm_v1_zsurf', 'MARv3_11_ERA_zsurf', 'MARv3_11_2_ERA_10km_zsurf',\n",
    "    # 'MARv3_11_2_ERA_20km_zsurf',\n",
    "    # 'MARv3_11_2_NCEP_20km_zsurf']\n",
    "    models=['GSFC_fdm_v1_zsurf',  'MARv3_11_2_ERA_10km_zsurf',\n",
    "       'MARv3_11_2_NCEP_20km_zsurf']\n",
    "    \n",
    "    \n",
    "    #short names\n",
    "\n",
    "    sigma_sn={model:f'$\\sigma_{{{sn[model]}}}$' for model in sn.keys()}\n",
    "        \n",
    "    column_list=['basin','raw', sigma_sn['raw']]\n",
    "    for model in models:\n",
    "        column_list += [sn[model]]\n",
    "        column_list += [sigma_sn[model]]\n",
    "\n",
    "    df={var:np.zeros(len(basins)) for var in column_list}\n",
    "    df['basin']=np.arange(len(basins), dtype=int)+1\n",
    "    \n",
    "    # first two lines give  model, and resolution\n",
    "    str1='basin\\t raw'\n",
    "    str2='\\t \\t'\n",
    "    for model in models:\n",
    "        m=re.compile('(.*)_(..km)_zsurf').search(model)\n",
    "        if m is not None:\n",
    "            str1 += f'\\t {m.group(1)}'\n",
    "            str2 += f'\\t {m.group(2)}'\n",
    "        else:\n",
    "            str1 += f'\\t {model.replace(\"_zsurf\",\"\")}'\n",
    "            str2 += '\\t 15km'              \n",
    "\n",
    "    print(f'{epoch}\\t{h_range[0]} m to {h_range[1]} m, {var}')\n",
    "    #print(str1)\n",
    "    #print(str2)\n",
    "    # remaining lines give basin, range center, and range spread\n",
    "    for basin in basins:\n",
    "        raw=pct[epoch][models[1]][h_range]['raw'][basin-1,:]\n",
    "        thestr=f'{basin}:\\t {0.5*(raw[ p1]+raw[p0]):2.3f}({(raw[ p1]-raw[p0]):2.3f})'\n",
    "        df['raw'][basin-1]=0.5*(raw[ p1]+raw[p0])\n",
    "        df[sigma_sn['raw']][basin-1]=(raw[ p1]-raw[p0])\n",
    "        for model in models:        \n",
    "            corr=pct[epoch][model][h_range]['corr'][basin-1,:]\n",
    "            thestr += f' \\t{0.5*(corr[p1]-corr[p0]):2.3f}({(corr[p1]-corr[p0]):2.3f})'\n",
    "            df[sn[model]][basin-1]=0.5*(corr[p1]-corr[p0])\n",
    "            df[sigma_sn[model]][basin-1]=corr[p1]-corr[p0]                  \n",
    "        #print(thestr)\n",
    "    #df=pd.DataFrame(df)\n",
    "    #df=df[columns]\n",
    "    df=pd.DataFrame(df)[column_list]\n",
    "    return df\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "def highlight_minabs(data, color='yellow'):\n",
    "    '''\n",
    "    highlight the maximum in a Series or DataFrame\n",
    "    '''\n",
    "    attr = 'background-color: {}'.format(color)\n",
    "    if data.ndim == 1:  # Series from .apply(axis=0) or axis=1\n",
    "        is_min = np.abs(data) == np.abs(data).min()\n",
    "        return [attr if v else '' for v in is_min]\n",
    "    else:  # from .apply(axis=None)\n",
    "        is_min = data == np.abs(data).min().min()\n",
    "        return pd.DataFrame(np.where(is_max, attr, ''),\n",
    "                            index=data.index, columns=data.columns)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "def bold_abs_lt_first(data):\n",
    "    '''\n",
    "    highlight the maximum in a Series or DataFrame\n",
    "    '''\n",
    "    attr_good = 'font-weight: bold' \n",
    "    attr_bad = 'color : red'\n",
    "    is_lt = np.abs(data) < np.abs(data[0])\n",
    "    temp = [attr_good if v else attr_bad for v in is_lt]\n",
    "    temp[0] = ''\n",
    "    return temp\n",
    "    "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Center statistics: Central peak\n",
    "Look at the width of the central peak for two epochs.  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### All data, low elevation:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "all\t-10 m to 2000 m, ctr\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row0_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row0_col2 {\n",
       "            background-color:  orange;\n",
       "            : ;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row0_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row0_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row0_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row0_col6 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row0_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row0_col8 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row1_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row1_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row1_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row1_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row1_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row1_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row1_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row2_col3 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row2_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row2_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row2_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row2_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row2_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row3_col3 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row3_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row3_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row3_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row3_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row3_col8 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row4_col3 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row4_col4 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row4_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row4_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row4_col7 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row4_col8 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row5_col3 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row5_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row5_col5 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row5_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row5_col7 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row5_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row6_col3 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row6_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row6_col5 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row6_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row6_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row6_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row7_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row7_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row7_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row7_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row7_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row7_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row7_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }</style><table id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08\" ><thead>    <tr>        <th class=\"blank level0\" ></th>        <th class=\"col_heading level0 col0\" >basin</th>        <th class=\"col_heading level0 col1\" >raw</th>        <th class=\"col_heading level0 col2\" >$\\sigma_{raw}$</th>        <th class=\"col_heading level0 col3\" >GSFC_v1</th>        <th class=\"col_heading level0 col4\" >$\\sigma_{GSFC_v1}$</th>        <th class=\"col_heading level0 col5\" >M3.11.2ERA10</th>        <th class=\"col_heading level0 col6\" >$\\sigma_{M3.11.2ERA10}$</th>        <th class=\"col_heading level0 col7\" >M311.2NC20</th>        <th class=\"col_heading level0 col8\" >$\\sigma_{M311.2NC20}$</th>    </tr></thead><tbody>\n",
       "                <tr>\n",
       "                        <th id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row0_col0\" class=\"data row0 col0\" >1</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row0_col1\" class=\"data row0 col1\" >-0.03</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row0_col2\" class=\"data row0 col2\" >0.24</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row0_col3\" class=\"data row0 col3\" >0.12</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row0_col4\" class=\"data row0 col4\" >0.24</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row0_col5\" class=\"data row0 col5\" >0.14</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row0_col6\" class=\"data row0 col6\" >0.28</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row0_col7\" class=\"data row0 col7\" >0.17</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row0_col8\" class=\"data row0 col8\" >0.35</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row1_col0\" class=\"data row1 col0\" >2</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row1_col1\" class=\"data row1 col1\" >-0.11</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row1_col2\" class=\"data row1 col2\" >0.44</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row1_col3\" class=\"data row1 col3\" >0.15</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row1_col4\" class=\"data row1 col4\" >0.29</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row1_col5\" class=\"data row1 col5\" >0.17</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row1_col6\" class=\"data row1 col6\" >0.35</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row1_col7\" class=\"data row1 col7\" >0.17</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row1_col8\" class=\"data row1 col8\" >0.34</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08level0_row2\" class=\"row_heading level0 row2\" >2</th>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row2_col0\" class=\"data row2 col0\" >3</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row2_col1\" class=\"data row2 col1\" >-0.32</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row2_col2\" class=\"data row2 col2\" >1.01</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row2_col3\" class=\"data row2 col3\" >0.23</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row2_col4\" class=\"data row2 col4\" >0.46</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row2_col5\" class=\"data row2 col5\" >0.36</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row2_col6\" class=\"data row2 col6\" >0.72</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row2_col7\" class=\"data row2 col7\" >0.32</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row2_col8\" class=\"data row2 col8\" >0.64</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08level0_row3\" class=\"row_heading level0 row3\" >3</th>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row3_col0\" class=\"data row3 col0\" >4</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row3_col1\" class=\"data row3 col1\" >-0.39</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row3_col2\" class=\"data row3 col2\" >1.99</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row3_col3\" class=\"data row3 col3\" >0.30</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row3_col4\" class=\"data row3 col4\" >0.60</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row3_col5\" class=\"data row3 col5\" >0.98</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row3_col6\" class=\"data row3 col6\" >1.95</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row3_col7\" class=\"data row3 col7\" >1.13</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row3_col8\" class=\"data row3 col8\" >2.25</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08level0_row4\" class=\"row_heading level0 row4\" >4</th>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row4_col0\" class=\"data row4 col0\" >5</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row4_col1\" class=\"data row4 col1\" >-0.42</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row4_col2\" class=\"data row4 col2\" >1.75</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row4_col3\" class=\"data row4 col3\" >0.41</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row4_col4\" class=\"data row4 col4\" >0.82</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row4_col5\" class=\"data row4 col5\" >0.46</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row4_col6\" class=\"data row4 col6\" >0.91</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row4_col7\" class=\"data row4 col7\" >0.41</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row4_col8\" class=\"data row4 col8\" >0.81</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08level0_row5\" class=\"row_heading level0 row5\" >5</th>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row5_col0\" class=\"data row5 col0\" >6</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row5_col1\" class=\"data row5 col1\" >-0.44</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row5_col2\" class=\"data row5 col2\" >1.37</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row5_col3\" class=\"data row5 col3\" >0.26</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row5_col4\" class=\"data row5 col4\" >0.52</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row5_col5\" class=\"data row5 col5\" >0.41</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row5_col6\" class=\"data row5 col6\" >0.83</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row5_col7\" class=\"data row5 col7\" >0.38</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row5_col8\" class=\"data row5 col8\" >0.75</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08level0_row6\" class=\"row_heading level0 row6\" >6</th>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row6_col0\" class=\"data row6 col0\" >7</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row6_col1\" class=\"data row6 col1\" >-0.39</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row6_col2\" class=\"data row6 col2\" >0.96</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row6_col3\" class=\"data row6 col3\" >0.20</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row6_col4\" class=\"data row6 col4\" >0.40</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row6_col5\" class=\"data row6 col5\" >0.35</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row6_col6\" class=\"data row6 col6\" >0.70</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row6_col7\" class=\"data row6 col7\" >0.41</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row6_col8\" class=\"data row6 col8\" >0.83</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08level0_row7\" class=\"row_heading level0 row7\" >7</th>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row7_col0\" class=\"data row7 col0\" >8</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row7_col1\" class=\"data row7 col1\" >-0.05</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row7_col2\" class=\"data row7 col2\" >0.79</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row7_col3\" class=\"data row7 col3\" >0.22</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row7_col4\" class=\"data row7 col4\" >0.43</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row7_col5\" class=\"data row7 col5\" >0.24</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row7_col6\" class=\"data row7 col6\" >0.48</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row7_col7\" class=\"data row7 col7\" >0.28</td>\n",
       "                        <td id=\"T_3e08ee6a_e8b3_11ea_ac00_ac1f6b600c08row7_col8\" class=\"data row7 col8\" >0.56</td>\n",
       "            </tr>\n",
       "    </tbody></table>"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x7f064e8558d0>"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df=all_basin_stats(pct, 'all', h_ranges[0],'ctr')\n",
    "df.style.set_precision(2).apply(highlight_minabs, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(highlight_minabs, color='orange', axis=1, subset=[sigma_sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sigma_sn[model] for model in sn.keys()])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### All data, high elevation:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "all\t2000 m to 5000 m, ctr\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row0_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row0_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row0_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row0_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row0_col6 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row0_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row0_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row1_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row1_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row1_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row1_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row1_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row1_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row1_col8 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row2_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row2_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row2_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row2_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row2_col6 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row2_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row2_col8 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row3_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row3_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row3_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row3_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row3_col6 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row3_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row3_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row4_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row4_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row4_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row4_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row4_col6 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row4_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row4_col8 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row5_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row5_col2 {\n",
       "            background-color:  orange;\n",
       "            : ;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row5_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row5_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row5_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row5_col6 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row5_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row5_col8 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row6_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row6_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row6_col5 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row6_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row6_col7 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row6_col8 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row7_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row7_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row7_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row7_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row7_col6 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row7_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row7_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }</style><table id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08\" ><thead>    <tr>        <th class=\"blank level0\" ></th>        <th class=\"col_heading level0 col0\" >basin</th>        <th class=\"col_heading level0 col1\" >raw</th>        <th class=\"col_heading level0 col2\" >$\\sigma_{raw}$</th>        <th class=\"col_heading level0 col3\" >GSFC_v1</th>        <th class=\"col_heading level0 col4\" >$\\sigma_{GSFC_v1}$</th>        <th class=\"col_heading level0 col5\" >M3.11.2ERA10</th>        <th class=\"col_heading level0 col6\" >$\\sigma_{M3.11.2ERA10}$</th>        <th class=\"col_heading level0 col7\" >M311.2NC20</th>        <th class=\"col_heading level0 col8\" >$\\sigma_{M311.2NC20}$</th>    </tr></thead><tbody>\n",
       "                <tr>\n",
       "                        <th id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row0_col0\" class=\"data row0 col0\" >1</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row0_col1\" class=\"data row0 col1\" >-0.02</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row0_col2\" class=\"data row0 col2\" >0.15</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row0_col3\" class=\"data row0 col3\" >0.08</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row0_col4\" class=\"data row0 col4\" >0.17</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row0_col5\" class=\"data row0 col5\" >0.06</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row0_col6\" class=\"data row0 col6\" >0.12</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row0_col7\" class=\"data row0 col7\" >0.06</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row0_col8\" class=\"data row0 col8\" >0.12</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row1_col0\" class=\"data row1 col0\" >2</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row1_col1\" class=\"data row1 col1\" >-0.01</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row1_col2\" class=\"data row1 col2\" >0.16</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row1_col3\" class=\"data row1 col3\" >0.10</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row1_col4\" class=\"data row1 col4\" >0.20</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row1_col5\" class=\"data row1 col5\" >0.06</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row1_col6\" class=\"data row1 col6\" >0.12</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row1_col7\" class=\"data row1 col7\" >0.06</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row1_col8\" class=\"data row1 col8\" >0.12</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08level0_row2\" class=\"row_heading level0 row2\" >2</th>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row2_col0\" class=\"data row2 col0\" >3</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row2_col1\" class=\"data row2 col1\" >-0.05</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row2_col2\" class=\"data row2 col2\" >0.23</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row2_col3\" class=\"data row2 col3\" >0.14</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row2_col4\" class=\"data row2 col4\" >0.29</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row2_col5\" class=\"data row2 col5\" >0.12</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row2_col6\" class=\"data row2 col6\" >0.24</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row2_col7\" class=\"data row2 col7\" >0.11</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row2_col8\" class=\"data row2 col8\" >0.21</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08level0_row3\" class=\"row_heading level0 row3\" >3</th>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row3_col0\" class=\"data row3 col0\" >4</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row3_col1\" class=\"data row3 col1\" >-0.03</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row3_col2\" class=\"data row3 col2\" >0.52</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row3_col3\" class=\"data row3 col3\" >0.19</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row3_col4\" class=\"data row3 col4\" >0.37</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row3_col5\" class=\"data row3 col5\" >0.30</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row3_col6\" class=\"data row3 col6\" >0.60</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row3_col7\" class=\"data row3 col7\" >0.22</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row3_col8\" class=\"data row3 col8\" >0.44</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08level0_row4\" class=\"row_heading level0 row4\" >4</th>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row4_col0\" class=\"data row4 col0\" >5</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row4_col1\" class=\"data row4 col1\" >-0.15</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row4_col2\" class=\"data row4 col2\" >0.76</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row4_col3\" class=\"data row4 col3\" >0.40</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row4_col4\" class=\"data row4 col4\" >0.80</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row4_col5\" class=\"data row4 col5\" >0.44</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row4_col6\" class=\"data row4 col6\" >0.88</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row4_col7\" class=\"data row4 col7\" >0.36</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row4_col8\" class=\"data row4 col8\" >0.72</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08level0_row5\" class=\"row_heading level0 row5\" >5</th>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row5_col0\" class=\"data row5 col0\" >6</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row5_col1\" class=\"data row5 col1\" >-0.15</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row5_col2\" class=\"data row5 col2\" >0.35</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row5_col3\" class=\"data row5 col3\" >0.27</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row5_col4\" class=\"data row5 col4\" >0.55</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row5_col5\" class=\"data row5 col5\" >0.26</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row5_col6\" class=\"data row5 col6\" >0.53</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row5_col7\" class=\"data row5 col7\" >0.22</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row5_col8\" class=\"data row5 col8\" >0.45</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08level0_row6\" class=\"row_heading level0 row6\" >6</th>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row6_col0\" class=\"data row6 col0\" >7</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row6_col1\" class=\"data row6 col1\" >-0.10</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row6_col2\" class=\"data row6 col2\" >0.22</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row6_col3\" class=\"data row6 col3\" >0.13</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row6_col4\" class=\"data row6 col4\" >0.26</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row6_col5\" class=\"data row6 col5\" >0.09</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row6_col6\" class=\"data row6 col6\" >0.19</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row6_col7\" class=\"data row6 col7\" >0.08</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row6_col8\" class=\"data row6 col8\" >0.17</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08level0_row7\" class=\"row_heading level0 row7\" >7</th>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row7_col0\" class=\"data row7 col0\" >8</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row7_col1\" class=\"data row7 col1\" >-0.02</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row7_col2\" class=\"data row7 col2\" >0.18</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row7_col3\" class=\"data row7 col3\" >0.11</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row7_col4\" class=\"data row7 col4\" >0.23</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row7_col5\" class=\"data row7 col5\" >0.08</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row7_col6\" class=\"data row7 col6\" >0.16</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row7_col7\" class=\"data row7 col7\" >0.08</td>\n",
       "                        <td id=\"T_4e0fee12_e8b3_11ea_ac00_ac1f6b600c08row7_col8\" class=\"data row7 col8\" >0.17</td>\n",
       "            </tr>\n",
       "    </tbody></table>"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x7f064ffa6ef0>"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df=all_basin_stats(pct, 'all', h_ranges[1],'ctr')\n",
    "df.style.set_precision(2).apply(highlight_minabs, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(highlight_minabs, color='orange', axis=1, subset=[sigma_sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sigma_sn[model] for model in sn.keys()])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### All non-melt data, at low elevation:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "non_melt\t-10 m to 2000 m, ctr\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row0_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row0_col2 {\n",
       "            background-color:  orange;\n",
       "            : ;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row0_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row0_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row0_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row0_col6 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row0_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row0_col8 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row1_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row1_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row1_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row1_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row1_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row1_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row1_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row2_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row2_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row2_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row2_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row2_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row2_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row2_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row3_col3 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row3_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row3_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row3_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row3_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row3_col8 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row4_col3 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row4_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row4_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row4_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row4_col7 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row4_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row5_col3 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row5_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row5_col5 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row5_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row5_col7 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row5_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row6_col3 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row6_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row6_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row6_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row6_col7 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row6_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row7_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row7_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row7_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row7_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row7_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row7_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row7_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }</style><table id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08\" ><thead>    <tr>        <th class=\"blank level0\" ></th>        <th class=\"col_heading level0 col0\" >basin</th>        <th class=\"col_heading level0 col1\" >raw</th>        <th class=\"col_heading level0 col2\" >$\\sigma_{raw}$</th>        <th class=\"col_heading level0 col3\" >GSFC_v1</th>        <th class=\"col_heading level0 col4\" >$\\sigma_{GSFC_v1}$</th>        <th class=\"col_heading level0 col5\" >M3.11.2ERA10</th>        <th class=\"col_heading level0 col6\" >$\\sigma_{M3.11.2ERA10}$</th>        <th class=\"col_heading level0 col7\" >M311.2NC20</th>        <th class=\"col_heading level0 col8\" >$\\sigma_{M311.2NC20}$</th>    </tr></thead><tbody>\n",
       "                <tr>\n",
       "                        <th id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row0_col0\" class=\"data row0 col0\" >1</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row0_col1\" class=\"data row0 col1\" >-0.01</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row0_col2\" class=\"data row0 col2\" >0.24</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row0_col3\" class=\"data row0 col3\" >0.12</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row0_col4\" class=\"data row0 col4\" >0.25</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row0_col5\" class=\"data row0 col5\" >0.13</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row0_col6\" class=\"data row0 col6\" >0.27</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row0_col7\" class=\"data row0 col7\" >0.17</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row0_col8\" class=\"data row0 col8\" >0.33</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row1_col0\" class=\"data row1 col0\" >2</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row1_col1\" class=\"data row1 col1\" >-0.05</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row1_col2\" class=\"data row1 col2\" >0.39</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row1_col3\" class=\"data row1 col3\" >0.14</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row1_col4\" class=\"data row1 col4\" >0.29</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row1_col5\" class=\"data row1 col5\" >0.16</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row1_col6\" class=\"data row1 col6\" >0.32</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row1_col7\" class=\"data row1 col7\" >0.17</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row1_col8\" class=\"data row1 col8\" >0.33</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08level0_row2\" class=\"row_heading level0 row2\" >2</th>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row2_col0\" class=\"data row2 col0\" >3</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row2_col1\" class=\"data row2 col1\" >-0.21</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row2_col2\" class=\"data row2 col2\" >0.87</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row2_col3\" class=\"data row2 col3\" >0.23</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row2_col4\" class=\"data row2 col4\" >0.46</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row2_col5\" class=\"data row2 col5\" >0.35</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row2_col6\" class=\"data row2 col6\" >0.70</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row2_col7\" class=\"data row2 col7\" >0.31</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row2_col8\" class=\"data row2 col8\" >0.62</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08level0_row3\" class=\"row_heading level0 row3\" >3</th>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row3_col0\" class=\"data row3 col0\" >4</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row3_col1\" class=\"data row3 col1\" >-0.43</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row3_col2\" class=\"data row3 col2\" >2.01</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row3_col3\" class=\"data row3 col3\" >0.26</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row3_col4\" class=\"data row3 col4\" >0.53</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row3_col5\" class=\"data row3 col5\" >0.96</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row3_col6\" class=\"data row3 col6\" >1.91</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row3_col7\" class=\"data row3 col7\" >1.12</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row3_col8\" class=\"data row3 col8\" >2.24</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08level0_row4\" class=\"row_heading level0 row4\" >4</th>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row4_col0\" class=\"data row4 col0\" >5</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row4_col1\" class=\"data row4 col1\" >-0.45</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row4_col2\" class=\"data row4 col2\" >1.83</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row4_col3\" class=\"data row4 col3\" >0.42</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row4_col4\" class=\"data row4 col4\" >0.83</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row4_col5\" class=\"data row4 col5\" >0.47</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row4_col6\" class=\"data row4 col6\" >0.94</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row4_col7\" class=\"data row4 col7\" >0.44</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row4_col8\" class=\"data row4 col8\" >0.87</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08level0_row5\" class=\"row_heading level0 row5\" >5</th>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row5_col0\" class=\"data row5 col0\" >6</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row5_col1\" class=\"data row5 col1\" >-0.38</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row5_col2\" class=\"data row5 col2\" >1.32</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row5_col3\" class=\"data row5 col3\" >0.25</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row5_col4\" class=\"data row5 col4\" >0.49</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row5_col5\" class=\"data row5 col5\" >0.38</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row5_col6\" class=\"data row5 col6\" >0.75</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row5_col7\" class=\"data row5 col7\" >0.33</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row5_col8\" class=\"data row5 col8\" >0.67</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08level0_row6\" class=\"row_heading level0 row6\" >6</th>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row6_col0\" class=\"data row6 col0\" >7</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row6_col1\" class=\"data row6 col1\" >-0.31</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row6_col2\" class=\"data row6 col2\" >0.88</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row6_col3\" class=\"data row6 col3\" >0.19</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row6_col4\" class=\"data row6 col4\" >0.39</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row6_col5\" class=\"data row6 col5\" >0.33</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row6_col6\" class=\"data row6 col6\" >0.65</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row6_col7\" class=\"data row6 col7\" >0.28</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row6_col8\" class=\"data row6 col8\" >0.56</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08level0_row7\" class=\"row_heading level0 row7\" >7</th>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row7_col0\" class=\"data row7 col0\" >8</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row7_col1\" class=\"data row7 col1\" >0.05</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row7_col2\" class=\"data row7 col2\" >0.76</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row7_col3\" class=\"data row7 col3\" >0.21</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row7_col4\" class=\"data row7 col4\" >0.43</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row7_col5\" class=\"data row7 col5\" >0.23</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row7_col6\" class=\"data row7 col6\" >0.46</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row7_col7\" class=\"data row7 col7\" >0.24</td>\n",
       "                        <td id=\"T_4fdcbbda_e8b3_11ea_ac00_ac1f6b600c08row7_col8\" class=\"data row7 col8\" >0.48</td>\n",
       "            </tr>\n",
       "    </tbody></table>"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x7f064ffa6c88>"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df=all_basin_stats(pct, 'non_melt', h_ranges[0],'ctr')\n",
    "df.style.set_precision(2).apply(highlight_minabs, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(highlight_minabs, color='orange', axis=1, subset=[sigma_sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sigma_sn[model] for model in sn.keys()])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### All melt data, at low elevation:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "melt\t-10 m to 2000 m, ctr\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row0_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row0_col2 {\n",
       "            background-color:  orange;\n",
       "            : ;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row0_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row0_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row0_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row0_col6 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row0_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row0_col8 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row1_col3 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row1_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row1_col5 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row1_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row1_col7 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row1_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row2_col3 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row2_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row2_col5 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row2_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row2_col7 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row2_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row3_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row3_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row3_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row3_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row3_col6 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row3_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row3_col8 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row4_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row4_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row4_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row4_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row4_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row4_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row4_col8 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row5_col3 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row5_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row5_col5 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row5_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row5_col7 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row5_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row6_col3 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row6_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row6_col5 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row6_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row6_col7 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row6_col8 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row7_col3 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row7_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row7_col5 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row7_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row7_col7 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row7_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }</style><table id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08\" ><thead>    <tr>        <th class=\"blank level0\" ></th>        <th class=\"col_heading level0 col0\" >basin</th>        <th class=\"col_heading level0 col1\" >raw</th>        <th class=\"col_heading level0 col2\" >$\\sigma_{raw}$</th>        <th class=\"col_heading level0 col3\" >GSFC_v1</th>        <th class=\"col_heading level0 col4\" >$\\sigma_{GSFC_v1}$</th>        <th class=\"col_heading level0 col5\" >M3.11.2ERA10</th>        <th class=\"col_heading level0 col6\" >$\\sigma_{M3.11.2ERA10}$</th>        <th class=\"col_heading level0 col7\" >M311.2NC20</th>        <th class=\"col_heading level0 col8\" >$\\sigma_{M311.2NC20}$</th>    </tr></thead><tbody>\n",
       "                <tr>\n",
       "                        <th id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row0_col0\" class=\"data row0 col0\" >1</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row0_col1\" class=\"data row0 col1\" >-0.08</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row0_col2\" class=\"data row0 col2\" >0.22</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row0_col3\" class=\"data row0 col3\" >0.12</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row0_col4\" class=\"data row0 col4\" >0.24</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row0_col5\" class=\"data row0 col5\" >0.16</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row0_col6\" class=\"data row0 col6\" >0.31</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row0_col7\" class=\"data row0 col7\" >0.21</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row0_col8\" class=\"data row0 col8\" >0.42</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row1_col0\" class=\"data row1 col0\" >2</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row1_col1\" class=\"data row1 col1\" >-0.22</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row1_col2\" class=\"data row1 col2\" >0.41</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row1_col3\" class=\"data row1 col3\" >0.15</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row1_col4\" class=\"data row1 col4\" >0.30</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row1_col5\" class=\"data row1 col5\" >0.20</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row1_col6\" class=\"data row1 col6\" >0.40</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row1_col7\" class=\"data row1 col7\" >0.19</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row1_col8\" class=\"data row1 col8\" >0.38</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08level0_row2\" class=\"row_heading level0 row2\" >2</th>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row2_col0\" class=\"data row2 col0\" >3</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row2_col1\" class=\"data row2 col1\" >-0.52</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row2_col2\" class=\"data row2 col2\" >1.14</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row2_col3\" class=\"data row2 col3\" >0.22</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row2_col4\" class=\"data row2 col4\" >0.44</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row2_col5\" class=\"data row2 col5\" >0.39</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row2_col6\" class=\"data row2 col6\" >0.78</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row2_col7\" class=\"data row2 col7\" >0.37</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row2_col8\" class=\"data row2 col8\" >0.74</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08level0_row3\" class=\"row_heading level0 row3\" >3</th>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row3_col0\" class=\"data row3 col0\" >4</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row3_col1\" class=\"data row3 col1\" >-0.13</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row3_col2\" class=\"data row3 col2\" >1.94</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row3_col3\" class=\"data row3 col3\" >0.49</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row3_col4\" class=\"data row3 col4\" >0.99</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row3_col5\" class=\"data row3 col5\" >1.05</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row3_col6\" class=\"data row3 col6\" >2.10</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row3_col7\" class=\"data row3 col7\" >1.26</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row3_col8\" class=\"data row3 col8\" >2.53</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08level0_row4\" class=\"row_heading level0 row4\" >4</th>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row4_col0\" class=\"data row4 col0\" >5</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row4_col1\" class=\"data row4 col1\" >-0.08</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row4_col2\" class=\"data row4 col2\" >0.79</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row4_col3\" class=\"data row4 col3\" >0.31</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row4_col4\" class=\"data row4 col4\" >0.61</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row4_col5\" class=\"data row4 col5\" >0.34</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row4_col6\" class=\"data row4 col6\" >0.67</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row4_col7\" class=\"data row4 col7\" >0.40</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row4_col8\" class=\"data row4 col8\" >0.80</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08level0_row5\" class=\"row_heading level0 row5\" >5</th>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row5_col0\" class=\"data row5 col0\" >6</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row5_col1\" class=\"data row5 col1\" >-0.69</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row5_col2\" class=\"data row5 col2\" >1.34</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row5_col3\" class=\"data row5 col3\" >0.28</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row5_col4\" class=\"data row5 col4\" >0.56</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row5_col5\" class=\"data row5 col5\" >0.47</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row5_col6\" class=\"data row5 col6\" >0.94</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row5_col7\" class=\"data row5 col7\" >0.56</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row5_col8\" class=\"data row5 col8\" >1.11</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08level0_row6\" class=\"row_heading level0 row6\" >6</th>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row6_col0\" class=\"data row6 col0\" >7</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row6_col1\" class=\"data row6 col1\" >-0.65</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row6_col2\" class=\"data row6 col2\" >0.92</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row6_col3\" class=\"data row6 col3\" >0.21</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row6_col4\" class=\"data row6 col4\" >0.42</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row6_col5\" class=\"data row6 col5\" >0.38</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row6_col6\" class=\"data row6 col6\" >0.76</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row6_col7\" class=\"data row6 col7\" >0.48</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row6_col8\" class=\"data row6 col8\" >0.97</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08level0_row7\" class=\"row_heading level0 row7\" >7</th>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row7_col0\" class=\"data row7 col0\" >8</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row7_col1\" class=\"data row7 col1\" >-0.39</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row7_col2\" class=\"data row7 col2\" >0.66</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row7_col3\" class=\"data row7 col3\" >0.22</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row7_col4\" class=\"data row7 col4\" >0.44</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row7_col5\" class=\"data row7 col5\" >0.22</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row7_col6\" class=\"data row7 col6\" >0.45</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row7_col7\" class=\"data row7 col7\" >0.31</td>\n",
       "                        <td id=\"T_519804f2_e8b3_11ea_ac00_ac1f6b600c08row7_col8\" class=\"data row7 col8\" >0.62</td>\n",
       "            </tr>\n",
       "    </tbody></table>"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x7f064e7bfb70>"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df=all_basin_stats(pct, 'melt', h_ranges[0],'ctr')\n",
    "df.style.set_precision(2).apply(highlight_minabs, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(highlight_minabs, color='orange', axis=1, subset=[sigma_sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sigma_sn[model] for model in sn.keys()])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### All non-melt data, at high elevation:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "non_melt\t2000 m to 5000 m, ctr\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row0_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row0_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row0_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row0_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row0_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row0_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row0_col8 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row1_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row1_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row1_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row1_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row1_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row1_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row1_col8 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row2_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row2_col2 {\n",
       "            background-color:  orange;\n",
       "            : ;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row2_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row2_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row2_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row2_col6 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row2_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row2_col8 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row3_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row3_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row3_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row3_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row3_col6 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row3_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row3_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row4_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row4_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row4_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row4_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row4_col6 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row4_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row4_col8 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row5_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row5_col2 {\n",
       "            background-color:  orange;\n",
       "            : ;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row5_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row5_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row5_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row5_col6 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row5_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row5_col8 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row6_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row6_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row6_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row6_col6 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row6_col7 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row6_col8 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row7_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row7_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row7_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row7_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row7_col6 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row7_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row7_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }</style><table id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08\" ><thead>    <tr>        <th class=\"blank level0\" ></th>        <th class=\"col_heading level0 col0\" >basin</th>        <th class=\"col_heading level0 col1\" >raw</th>        <th class=\"col_heading level0 col2\" >$\\sigma_{raw}$</th>        <th class=\"col_heading level0 col3\" >GSFC_v1</th>        <th class=\"col_heading level0 col4\" >$\\sigma_{GSFC_v1}$</th>        <th class=\"col_heading level0 col5\" >M3.11.2ERA10</th>        <th class=\"col_heading level0 col6\" >$\\sigma_{M3.11.2ERA10}$</th>        <th class=\"col_heading level0 col7\" >M311.2NC20</th>        <th class=\"col_heading level0 col8\" >$\\sigma_{M311.2NC20}$</th>    </tr></thead><tbody>\n",
       "                <tr>\n",
       "                        <th id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row0_col0\" class=\"data row0 col0\" >1</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row0_col1\" class=\"data row0 col1\" >-0.01</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row0_col2\" class=\"data row0 col2\" >0.15</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row0_col3\" class=\"data row0 col3\" >0.08</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row0_col4\" class=\"data row0 col4\" >0.17</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row0_col5\" class=\"data row0 col5\" >0.06</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row0_col6\" class=\"data row0 col6\" >0.12</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row0_col7\" class=\"data row0 col7\" >0.06</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row0_col8\" class=\"data row0 col8\" >0.11</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row1_col0\" class=\"data row1 col0\" >2</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row1_col1\" class=\"data row1 col1\" >0.01</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row1_col2\" class=\"data row1 col2\" >0.15</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row1_col3\" class=\"data row1 col3\" >0.10</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row1_col4\" class=\"data row1 col4\" >0.20</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row1_col5\" class=\"data row1 col5\" >0.06</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row1_col6\" class=\"data row1 col6\" >0.12</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row1_col7\" class=\"data row1 col7\" >0.06</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row1_col8\" class=\"data row1 col8\" >0.12</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08level0_row2\" class=\"row_heading level0 row2\" >2</th>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row2_col0\" class=\"data row2 col0\" >3</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row2_col1\" class=\"data row2 col1\" >-0.02</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row2_col2\" class=\"data row2 col2\" >0.19</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row2_col3\" class=\"data row2 col3\" >0.14</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row2_col4\" class=\"data row2 col4\" >0.28</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row2_col5\" class=\"data row2 col5\" >0.11</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row2_col6\" class=\"data row2 col6\" >0.22</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row2_col7\" class=\"data row2 col7\" >0.10</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row2_col8\" class=\"data row2 col8\" >0.21</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08level0_row3\" class=\"row_heading level0 row3\" >3</th>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row3_col0\" class=\"data row3 col0\" >4</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row3_col1\" class=\"data row3 col1\" >-0.03</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row3_col2\" class=\"data row3 col2\" >0.52</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row3_col3\" class=\"data row3 col3\" >0.18</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row3_col4\" class=\"data row3 col4\" >0.36</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row3_col5\" class=\"data row3 col5\" >0.30</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row3_col6\" class=\"data row3 col6\" >0.59</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row3_col7\" class=\"data row3 col7\" >0.20</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row3_col8\" class=\"data row3 col8\" >0.41</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08level0_row4\" class=\"row_heading level0 row4\" >4</th>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row4_col0\" class=\"data row4 col0\" >5</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row4_col1\" class=\"data row4 col1\" >-0.14</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row4_col2\" class=\"data row4 col2\" >0.78</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row4_col3\" class=\"data row4 col3\" >0.40</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row4_col4\" class=\"data row4 col4\" >0.80</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row4_col5\" class=\"data row4 col5\" >0.44</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row4_col6\" class=\"data row4 col6\" >0.88</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row4_col7\" class=\"data row4 col7\" >0.35</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row4_col8\" class=\"data row4 col8\" >0.70</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08level0_row5\" class=\"row_heading level0 row5\" >5</th>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row5_col0\" class=\"data row5 col0\" >6</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row5_col1\" class=\"data row5 col1\" >-0.12</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row5_col2\" class=\"data row5 col2\" >0.31</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row5_col3\" class=\"data row5 col3\" >0.28</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row5_col4\" class=\"data row5 col4\" >0.55</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row5_col5\" class=\"data row5 col5\" >0.26</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row5_col6\" class=\"data row5 col6\" >0.53</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row5_col7\" class=\"data row5 col7\" >0.16</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row5_col8\" class=\"data row5 col8\" >0.32</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08level0_row6\" class=\"row_heading level0 row6\" >6</th>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row6_col0\" class=\"data row6 col0\" >7</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row6_col1\" class=\"data row6 col1\" >-0.08</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row6_col2\" class=\"data row6 col2\" >0.21</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row6_col3\" class=\"data row6 col3\" >0.12</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row6_col4\" class=\"data row6 col4\" >0.24</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row6_col5\" class=\"data row6 col5\" >0.09</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row6_col6\" class=\"data row6 col6\" >0.17</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row6_col7\" class=\"data row6 col7\" >0.07</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row6_col8\" class=\"data row6 col8\" >0.15</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08level0_row7\" class=\"row_heading level0 row7\" >7</th>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row7_col0\" class=\"data row7 col0\" >8</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row7_col1\" class=\"data row7 col1\" >-0.01</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row7_col2\" class=\"data row7 col2\" >0.19</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row7_col3\" class=\"data row7 col3\" >0.11</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row7_col4\" class=\"data row7 col4\" >0.21</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row7_col5\" class=\"data row7 col5\" >0.08</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row7_col6\" class=\"data row7 col6\" >0.15</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row7_col7\" class=\"data row7 col7\" >0.08</td>\n",
       "                        <td id=\"T_8dfca2ae_e8b3_11ea_ac00_ac1f6b600c08row7_col8\" class=\"data row7 col8\" >0.15</td>\n",
       "            </tr>\n",
       "    </tbody></table>"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x7f064e7d1358>"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df=all_basin_stats(pct, 'non_melt', h_ranges[1],'ctr')\n",
    "df.style.set_precision(2).apply(highlight_minabs, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(highlight_minabs, color='orange', axis=1, subset=[sigma_sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sigma_sn[model] for model in sn.keys()])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### All melt data, at high elevation:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "melt\t2000 m to 5000 m, ctr\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row0_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row0_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row0_col5 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row0_col6 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row0_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row0_col8 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row1_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row1_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row1_col5 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row1_col6 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row1_col7 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row1_col8 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row2_col2 {\n",
       "            background-color:  orange;\n",
       "            : ;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row2_col3 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row2_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row2_col5 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row2_col6 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row2_col7 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row2_col8 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row3_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row3_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row3_col4 {\n",
       "            background-color:  orange;\n",
       "            font-weight:  bold;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row3_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row3_col6 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row3_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row3_col8 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row4_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row4_col2 {\n",
       "            background-color:  orange;\n",
       "            : ;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row4_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row4_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row4_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row4_col6 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row4_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row4_col8 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row5_col2 {\n",
       "            background-color:  orange;\n",
       "            : ;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row5_col3 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row5_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row5_col5 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row5_col6 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row5_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row5_col8 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row6_col2 {\n",
       "            background-color:  orange;\n",
       "            : ;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row6_col3 {\n",
       "            : ;\n",
       "            font-weight:  bold;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row6_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row6_col5 {\n",
       "            background-color:  yellow;\n",
       "            font-weight:  bold;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row6_col6 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row6_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row6_col8 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row7_col1 {\n",
       "            background-color:  yellow;\n",
       "            : ;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row7_col2 {\n",
       "            background-color:  orange;\n",
       "            : ;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row7_col3 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row7_col4 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row7_col5 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row7_col6 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row7_col7 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }    #T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row7_col8 {\n",
       "            : ;\n",
       "            color :  red;\n",
       "        }</style><table id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08\" ><thead>    <tr>        <th class=\"blank level0\" ></th>        <th class=\"col_heading level0 col0\" >basin</th>        <th class=\"col_heading level0 col1\" >raw</th>        <th class=\"col_heading level0 col2\" >$\\sigma_{raw}$</th>        <th class=\"col_heading level0 col3\" >GSFC_v1</th>        <th class=\"col_heading level0 col4\" >$\\sigma_{GSFC_v1}$</th>        <th class=\"col_heading level0 col5\" >M3.11.2ERA10</th>        <th class=\"col_heading level0 col6\" >$\\sigma_{M3.11.2ERA10}$</th>        <th class=\"col_heading level0 col7\" >M311.2NC20</th>        <th class=\"col_heading level0 col8\" >$\\sigma_{M311.2NC20}$</th>    </tr></thead><tbody>\n",
       "                <tr>\n",
       "                        <th id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row0_col0\" class=\"data row0 col0\" >1</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row0_col1\" class=\"data row0 col1\" >-0.07</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row0_col2\" class=\"data row0 col2\" >0.11</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row0_col3\" class=\"data row0 col3\" >0.09</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row0_col4\" class=\"data row0 col4\" >0.17</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row0_col5\" class=\"data row0 col5\" >0.05</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row0_col6\" class=\"data row0 col6\" >0.11</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row0_col7\" class=\"data row0 col7\" >0.08</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row0_col8\" class=\"data row0 col8\" >0.15</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row1_col0\" class=\"data row1 col0\" >2</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row1_col1\" class=\"data row1 col1\" >-0.07</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row1_col2\" class=\"data row1 col2\" >0.12</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row1_col3\" class=\"data row1 col3\" >0.10</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row1_col4\" class=\"data row1 col4\" >0.20</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row1_col5\" class=\"data row1 col5\" >0.05</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row1_col6\" class=\"data row1 col6\" >0.11</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row1_col7\" class=\"data row1 col7\" >0.06</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row1_col8\" class=\"data row1 col8\" >0.11</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08level0_row2\" class=\"row_heading level0 row2\" >2</th>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row2_col0\" class=\"data row2 col0\" >3</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row2_col1\" class=\"data row2 col1\" >-0.17</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row2_col2\" class=\"data row2 col2\" >0.22</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row2_col3\" class=\"data row2 col3\" >0.16</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row2_col4\" class=\"data row2 col4\" >0.32</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row2_col5\" class=\"data row2 col5\" >0.15</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row2_col6\" class=\"data row2 col6\" >0.29</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row2_col7\" class=\"data row2 col7\" >0.14</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row2_col8\" class=\"data row2 col8\" >0.28</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08level0_row3\" class=\"row_heading level0 row3\" >3</th>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row3_col0\" class=\"data row3 col0\" >4</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row3_col1\" class=\"data row3 col1\" >-0.05</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row3_col2\" class=\"data row3 col2\" >0.54</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row3_col3\" class=\"data row3 col3\" >0.21</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row3_col4\" class=\"data row3 col4\" >0.41</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row3_col5\" class=\"data row3 col5\" >0.32</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row3_col6\" class=\"data row3 col6\" >0.64</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row3_col7\" class=\"data row3 col7\" >0.38</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row3_col8\" class=\"data row3 col8\" >0.75</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08level0_row4\" class=\"row_heading level0 row4\" >4</th>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row4_col0\" class=\"data row4 col0\" >5</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row4_col1\" class=\"data row4 col1\" >-0.31</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row4_col2\" class=\"data row4 col2\" >0.49</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row4_col3\" class=\"data row4 col3\" >0.33</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row4_col4\" class=\"data row4 col4\" >0.66</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row4_col5\" class=\"data row4 col5\" >0.43</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row4_col6\" class=\"data row4 col6\" >0.86</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row4_col7\" class=\"data row4 col7\" >0.55</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row4_col8\" class=\"data row4 col8\" >1.11</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08level0_row5\" class=\"row_heading level0 row5\" >5</th>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row5_col0\" class=\"data row5 col0\" >6</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row5_col1\" class=\"data row5 col1\" >-0.28</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row5_col2\" class=\"data row5 col2\" >0.32</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row5_col3\" class=\"data row5 col3\" >0.26</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row5_col4\" class=\"data row5 col4\" >0.52</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row5_col5\" class=\"data row5 col5\" >0.26</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row5_col6\" class=\"data row5 col6\" >0.52</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row5_col7\" class=\"data row5 col7\" >0.32</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row5_col8\" class=\"data row5 col8\" >0.64</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08level0_row6\" class=\"row_heading level0 row6\" >6</th>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row6_col0\" class=\"data row6 col0\" >7</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row6_col1\" class=\"data row6 col1\" >-0.17</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row6_col2\" class=\"data row6 col2\" >0.21</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row6_col3\" class=\"data row6 col3\" >0.15</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row6_col4\" class=\"data row6 col4\" >0.31</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row6_col5\" class=\"data row6 col5\" >0.12</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row6_col6\" class=\"data row6 col6\" >0.23</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row6_col7\" class=\"data row6 col7\" >0.19</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row6_col8\" class=\"data row6 col8\" >0.38</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08level0_row7\" class=\"row_heading level0 row7\" >7</th>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row7_col0\" class=\"data row7 col0\" >8</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row7_col1\" class=\"data row7 col1\" >-0.05</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row7_col2\" class=\"data row7 col2\" >0.15</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row7_col3\" class=\"data row7 col3\" >0.13</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row7_col4\" class=\"data row7 col4\" >0.26</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row7_col5\" class=\"data row7 col5\" >0.08</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row7_col6\" class=\"data row7 col6\" >0.17</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row7_col7\" class=\"data row7 col7\" >0.10</td>\n",
       "                        <td id=\"T_96ebe71c_e8b3_11ea_ac00_ac1f6b600c08row7_col8\" class=\"data row7 col8\" >0.20</td>\n",
       "            </tr>\n",
       "    </tbody></table>"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x7f064e7d0dd8>"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df=all_basin_stats(pct, 'melt', h_ranges[1],'ctr')\n",
    "df.style.set_precision(2).apply(highlight_minabs, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(highlight_minabs, color='orange', axis=1, subset=[sigma_sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sigma_sn[model] for model in sn.keys()])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Epoch 1 (Q4 of 2018 to Q2 of 2019), low elevation:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "df=all_basin_stats(pct, epochs[0], h_ranges[0],'ctr')\n",
    "df.style.set_precision(2).apply(highlight_minabs, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(highlight_minabs, color='orange', axis=1, subset=[sigma_sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sigma_sn[model] for model in sn.keys()])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Epoch 1 (Q4 of 2018 to Q2 of 2019), high elevation:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "df=all_basin_stats(pct, epochs[0], h_ranges[1],'ctr')\n",
    "df.style.set_precision(2).apply(highlight_minabs, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(highlight_minabs, color='orange', axis=1, subset=[sigma_sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sigma_sn[model] for model in sn.keys()])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Epoch 2: (Q1 of 2019 to Q2 of 2019), at low elevation:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "df=all_basin_stats(pct, epochs[1], h_ranges[0],'ctr')\n",
    "df.style.set_precision(2).apply(highlight_minabs, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(highlight_minabs, color='orange', axis=1, subset=[sigma_sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sigma_sn[model] for model in sn.keys()])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Epoch 2: (Q1 of 2019 to Q2 of 2019), at high elevation:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "df=all_basin_stats(pct, epochs[1], h_ranges[1],'ctr')\n",
    "df.style.set_precision(2).apply(highlight_minabs, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(highlight_minabs, color='orange', axis=1, subset=[sigma_sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sigma_sn[model] for model in sn.keys()])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "GSFC seems to have done the best job in reducing the model spread.  There isn't a substantial winner here among the MAR models.  The higher resolution models (MAR_v311_ERA @ 15km and Mar_v311.2 @ 10km) have smaller spreads in a few basins, but the differences are small. The corrections also don't seem to capture a large share of the variance in the data (spreads are comparable between raw and corrected data)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Epoch 3: (Q2 of 2019 to Q3 of 2019), at low elevation:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "df=all_basin_stats(pct, epochs[2], h_ranges[1],'ctr')\n",
    "df.style.set_precision(2).apply(highlight_minabs, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(highlight_minabs, color='orange', axis=1, subset=[sigma_sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sn[model] for model in sn.keys()])\\\n",
    "    .apply(bold_abs_lt_first, axis=1, subset=[sigma_sn[model] for model in sn.keys()])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Here the corrections seem to both make large reductions in the spread of the signal, and seem to correct for the large drawdown signals.  The statistics are similar across the models, although the v3.11.2 models seem to have modestly better spread than the V3.11 model, and the 10km v3.11.2 is better than the coarser resolution version.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# deeper dive into individual drainage basins: basin 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "basin=1\n",
    "h_range=h_ranges[0]\n",
    "h_bins=np.arange(-2, 2.01, 0.01)\n",
    "dh_hist={}\n",
    "dist_data={}\n",
    "for model in models:\n",
    "    dh_hist[model]={ver:np.zeros((len(h_bins)-1, len(epochs))) for ver in ['raw','corr']}\n",
    "    dh_hist[model].update({ver:np.zeros(len(epochs)) for ver in ['raw_med', 'corr_med']})\n",
    "    dh_hist[model]['raw_data']={}\n",
    "    dh_hist[model]['corr_data']={}\n",
    "    for col, epoch in enumerate(epochs):\n",
    "        Dsub=D[model][epoch]\n",
    "        els = np.floor(Dsub.basin)==basin\n",
    "        els &= (Dsub.h0 > h_range[0])\n",
    "        els &= (Dsub.h0 < h_range[1])\n",
    "        Dsub=Dsub[els]\n",
    "        dh_hist[model]['raw_med'][col] = np.median(Dsub.dh)\n",
    "        dh_hist[model]['corr_med'][col] = np.median(Dsub.dh_corr)\n",
    "        dh_hist[model]['raw'][:, col] = np.histogram(Dsub.dh, bins=h_bins, density=True)[0]\n",
    "        dh_hist[model]['corr'][:, col] = np.histogram(Dsub.dh_corr, bins=h_bins, density=True)[0]\n",
    "        good=np.abs(Dsub.dh_corr)<2.5\n",
    "        dh_hist[model]['raw_data'][epoch]=Dsub.dh[good]\n",
    "        dh_hist[model]['corr_data'][epoch]=Dsub.dh_corr[good]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This is a nicer way to compare two different models.  There's another version of violinplot that comes up on Google that puts one distribution on the left of each bar and one on the right.  Might be worth exploring."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/javascript": [
       "/* Put everything inside the global mpl namespace */\n",
       "window.mpl = {};\n",
       "\n",
       "\n",
       "mpl.get_websocket_type = function() {\n",
       "    if (typeof(WebSocket) !== 'undefined') {\n",
       "        return WebSocket;\n",
       "    } else if (typeof(MozWebSocket) !== 'undefined') {\n",
       "        return MozWebSocket;\n",
       "    } else {\n",
       "        alert('Your browser does not have WebSocket support. ' +\n",
       "              'Please try Chrome, Safari or Firefox ≥ 6. ' +\n",
       "              'Firefox 4 and 5 are also supported but you ' +\n",
       "              'have to enable WebSockets in about:config.');\n",
       "    };\n",
       "}\n",
       "\n",
       "mpl.figure = function(figure_id, websocket, ondownload, parent_element) {\n",
       "    this.id = figure_id;\n",
       "\n",
       "    this.ws = websocket;\n",
       "\n",
       "    this.supports_binary = (this.ws.binaryType != undefined);\n",
       "\n",
       "    if (!this.supports_binary) {\n",
       "        var warnings = document.getElementById(\"mpl-warnings\");\n",
       "        if (warnings) {\n",
       "            warnings.style.display = 'block';\n",
       "            warnings.textContent = (\n",
       "                \"This browser does not support binary websocket messages. \" +\n",
       "                    \"Performance may be slow.\");\n",
       "        }\n",
       "    }\n",
       "\n",
       "    this.imageObj = new Image();\n",
       "\n",
       "    this.context = undefined;\n",
       "    this.message = undefined;\n",
       "    this.canvas = undefined;\n",
       "    this.rubberband_canvas = undefined;\n",
       "    this.rubberband_context = undefined;\n",
       "    this.format_dropdown = undefined;\n",
       "\n",
       "    this.image_mode = 'full';\n",
       "\n",
       "    this.root = $('<div/>');\n",
       "    this._root_extra_style(this.root)\n",
       "    this.root.attr('style', 'display: inline-block');\n",
       "\n",
       "    $(parent_element).append(this.root);\n",
       "\n",
       "    this._init_header(this);\n",
       "    this._init_canvas(this);\n",
       "    this._init_toolbar(this);\n",
       "\n",
       "    var fig = this;\n",
       "\n",
       "    this.waiting = false;\n",
       "\n",
       "    this.ws.onopen =  function () {\n",
       "            fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
       "            fig.send_message(\"send_image_mode\", {});\n",
       "            if (mpl.ratio != 1) {\n",
       "                fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n",
       "            }\n",
       "            fig.send_message(\"refresh\", {});\n",
       "        }\n",
       "\n",
       "    this.imageObj.onload = function() {\n",
       "            if (fig.image_mode == 'full') {\n",
       "                // Full images could contain transparency (where diff images\n",
       "                // almost always do), so we need to clear the canvas so that\n",
       "                // there is no ghosting.\n",
       "                fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n",
       "            }\n",
       "            fig.context.drawImage(fig.imageObj, 0, 0);\n",
       "        };\n",
       "\n",
       "    this.imageObj.onunload = function() {\n",
       "        fig.ws.close();\n",
       "    }\n",
       "\n",
       "    this.ws.onmessage = this._make_on_message_function(this);\n",
       "\n",
       "    this.ondownload = ondownload;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_header = function() {\n",
       "    var titlebar = $(\n",
       "        '<div class=\"ui-dialog-titlebar ui-widget-header ui-corner-all ' +\n",
       "        'ui-helper-clearfix\"/>');\n",
       "    var titletext = $(\n",
       "        '<div class=\"ui-dialog-title\" style=\"width: 100%; ' +\n",
       "        'text-align: center; padding: 3px;\"/>');\n",
       "    titlebar.append(titletext)\n",
       "    this.root.append(titlebar);\n",
       "    this.header = titletext[0];\n",
       "}\n",
       "\n",
       "\n",
       "\n",
       "mpl.figure.prototype._canvas_extra_style = function(canvas_div) {\n",
       "\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype._root_extra_style = function(canvas_div) {\n",
       "\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_canvas = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var canvas_div = $('<div/>');\n",
       "\n",
       "    canvas_div.attr('style', 'position: relative; clear: both; outline: 0');\n",
       "\n",
       "    function canvas_keyboard_event(event) {\n",
       "        return fig.key_event(event, event['data']);\n",
       "    }\n",
       "\n",
       "    canvas_div.keydown('key_press', canvas_keyboard_event);\n",
       "    canvas_div.keyup('key_release', canvas_keyboard_event);\n",
       "    this.canvas_div = canvas_div\n",
       "    this._canvas_extra_style(canvas_div)\n",
       "    this.root.append(canvas_div);\n",
       "\n",
       "    var canvas = $('<canvas/>');\n",
       "    canvas.addClass('mpl-canvas');\n",
       "    canvas.attr('style', \"left: 0; top: 0; z-index: 0; outline: 0\")\n",
       "\n",
       "    this.canvas = canvas[0];\n",
       "    this.context = canvas[0].getContext(\"2d\");\n",
       "\n",
       "    var backingStore = this.context.backingStorePixelRatio ||\n",
       "\tthis.context.webkitBackingStorePixelRatio ||\n",
       "\tthis.context.mozBackingStorePixelRatio ||\n",
       "\tthis.context.msBackingStorePixelRatio ||\n",
       "\tthis.context.oBackingStorePixelRatio ||\n",
       "\tthis.context.backingStorePixelRatio || 1;\n",
       "\n",
       "    mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n",
       "\n",
       "    var rubberband = $('<canvas/>');\n",
       "    rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
       "\n",
       "    var pass_mouse_events = true;\n",
       "\n",
       "    canvas_div.resizable({\n",
       "        start: function(event, ui) {\n",
       "            pass_mouse_events = false;\n",
       "        },\n",
       "        resize: function(event, ui) {\n",
       "            fig.request_resize(ui.size.width, ui.size.height);\n",
       "        },\n",
       "        stop: function(event, ui) {\n",
       "            pass_mouse_events = true;\n",
       "            fig.request_resize(ui.size.width, ui.size.height);\n",
       "        },\n",
       "    });\n",
       "\n",
       "    function mouse_event_fn(event) {\n",
       "        if (pass_mouse_events)\n",
       "            return fig.mouse_event(event, event['data']);\n",
       "    }\n",
       "\n",
       "    rubberband.mousedown('button_press', mouse_event_fn);\n",
       "    rubberband.mouseup('button_release', mouse_event_fn);\n",
       "    // Throttle sequential mouse events to 1 every 20ms.\n",
       "    rubberband.mousemove('motion_notify', mouse_event_fn);\n",
       "\n",
       "    rubberband.mouseenter('figure_enter', mouse_event_fn);\n",
       "    rubberband.mouseleave('figure_leave', mouse_event_fn);\n",
       "\n",
       "    canvas_div.on(\"wheel\", function (event) {\n",
       "        event = event.originalEvent;\n",
       "        event['data'] = 'scroll'\n",
       "        if (event.deltaY < 0) {\n",
       "            event.step = 1;\n",
       "        } else {\n",
       "            event.step = -1;\n",
       "        }\n",
       "        mouse_event_fn(event);\n",
       "    });\n",
       "\n",
       "    canvas_div.append(canvas);\n",
       "    canvas_div.append(rubberband);\n",
       "\n",
       "    this.rubberband = rubberband;\n",
       "    this.rubberband_canvas = rubberband[0];\n",
       "    this.rubberband_context = rubberband[0].getContext(\"2d\");\n",
       "    this.rubberband_context.strokeStyle = \"#000000\";\n",
       "\n",
       "    this._resize_canvas = function(width, height) {\n",
       "        // Keep the size of the canvas, canvas container, and rubber band\n",
       "        // canvas in synch.\n",
       "        canvas_div.css('width', width)\n",
       "        canvas_div.css('height', height)\n",
       "\n",
       "        canvas.attr('width', width * mpl.ratio);\n",
       "        canvas.attr('height', height * mpl.ratio);\n",
       "        canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n",
       "\n",
       "        rubberband.attr('width', width);\n",
       "        rubberband.attr('height', height);\n",
       "    }\n",
       "\n",
       "    // Set the figure to an initial 600x600px, this will subsequently be updated\n",
       "    // upon first draw.\n",
       "    this._resize_canvas(600, 600);\n",
       "\n",
       "    // Disable right mouse context menu.\n",
       "    $(this.rubberband_canvas).bind(\"contextmenu\",function(e){\n",
       "        return false;\n",
       "    });\n",
       "\n",
       "    function set_focus () {\n",
       "        canvas.focus();\n",
       "        canvas_div.focus();\n",
       "    }\n",
       "\n",
       "    window.setTimeout(set_focus, 100);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_toolbar = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var nav_element = $('<div/>');\n",
       "    nav_element.attr('style', 'width: 100%');\n",
       "    this.root.append(nav_element);\n",
       "\n",
       "    // Define a callback function for later on.\n",
       "    function toolbar_event(event) {\n",
       "        return fig.toolbar_button_onclick(event['data']);\n",
       "    }\n",
       "    function toolbar_mouse_event(event) {\n",
       "        return fig.toolbar_button_onmouseover(event['data']);\n",
       "    }\n",
       "\n",
       "    for(var toolbar_ind in mpl.toolbar_items) {\n",
       "        var name = mpl.toolbar_items[toolbar_ind][0];\n",
       "        var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
       "        var image = mpl.toolbar_items[toolbar_ind][2];\n",
       "        var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
       "\n",
       "        if (!name) {\n",
       "            // put a spacer in here.\n",
       "            continue;\n",
       "        }\n",
       "        var button = $('<button/>');\n",
       "        button.addClass('ui-button ui-widget ui-state-default ui-corner-all ' +\n",
       "                        'ui-button-icon-only');\n",
       "        button.attr('role', 'button');\n",
       "        button.attr('aria-disabled', 'false');\n",
       "        button.click(method_name, toolbar_event);\n",
       "        button.mouseover(tooltip, toolbar_mouse_event);\n",
       "\n",
       "        var icon_img = $('<span/>');\n",
       "        icon_img.addClass('ui-button-icon-primary ui-icon');\n",
       "        icon_img.addClass(image);\n",
       "        icon_img.addClass('ui-corner-all');\n",
       "\n",
       "        var tooltip_span = $('<span/>');\n",
       "        tooltip_span.addClass('ui-button-text');\n",
       "        tooltip_span.html(tooltip);\n",
       "\n",
       "        button.append(icon_img);\n",
       "        button.append(tooltip_span);\n",
       "\n",
       "        nav_element.append(button);\n",
       "    }\n",
       "\n",
       "    var fmt_picker_span = $('<span/>');\n",
       "\n",
       "    var fmt_picker = $('<select/>');\n",
       "    fmt_picker.addClass('mpl-toolbar-option ui-widget ui-widget-content');\n",
       "    fmt_picker_span.append(fmt_picker);\n",
       "    nav_element.append(fmt_picker_span);\n",
       "    this.format_dropdown = fmt_picker[0];\n",
       "\n",
       "    for (var ind in mpl.extensions) {\n",
       "        var fmt = mpl.extensions[ind];\n",
       "        var option = $(\n",
       "            '<option/>', {selected: fmt === mpl.default_extension}).html(fmt);\n",
       "        fmt_picker.append(option);\n",
       "    }\n",
       "\n",
       "    // Add hover states to the ui-buttons\n",
       "    $( \".ui-button\" ).hover(\n",
       "        function() { $(this).addClass(\"ui-state-hover\");},\n",
       "        function() { $(this).removeClass(\"ui-state-hover\");}\n",
       "    );\n",
       "\n",
       "    var status_bar = $('<span class=\"mpl-message\"/>');\n",
       "    nav_element.append(status_bar);\n",
       "    this.message = status_bar[0];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.request_resize = function(x_pixels, y_pixels) {\n",
       "    // Request matplotlib to resize the figure. Matplotlib will then trigger a resize in the client,\n",
       "    // which will in turn request a refresh of the image.\n",
       "    this.send_message('resize', {'width': x_pixels, 'height': y_pixels});\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.send_message = function(type, properties) {\n",
       "    properties['type'] = type;\n",
       "    properties['figure_id'] = this.id;\n",
       "    this.ws.send(JSON.stringify(properties));\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.send_draw_message = function() {\n",
       "    if (!this.waiting) {\n",
       "        this.waiting = true;\n",
       "        this.ws.send(JSON.stringify({type: \"draw\", figure_id: this.id}));\n",
       "    }\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype.handle_save = function(fig, msg) {\n",
       "    var format_dropdown = fig.format_dropdown;\n",
       "    var format = format_dropdown.options[format_dropdown.selectedIndex].value;\n",
       "    fig.ondownload(fig, format);\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype.handle_resize = function(fig, msg) {\n",
       "    var size = msg['size'];\n",
       "    if (size[0] != fig.canvas.width || size[1] != fig.canvas.height) {\n",
       "        fig._resize_canvas(size[0], size[1]);\n",
       "        fig.send_message(\"refresh\", {});\n",
       "    };\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
       "    var x0 = msg['x0'] / mpl.ratio;\n",
       "    var y0 = (fig.canvas.height - msg['y0']) / mpl.ratio;\n",
       "    var x1 = msg['x1'] / mpl.ratio;\n",
       "    var y1 = (fig.canvas.height - msg['y1']) / mpl.ratio;\n",
       "    x0 = Math.floor(x0) + 0.5;\n",
       "    y0 = Math.floor(y0) + 0.5;\n",
       "    x1 = Math.floor(x1) + 0.5;\n",
       "    y1 = Math.floor(y1) + 0.5;\n",
       "    var min_x = Math.min(x0, x1);\n",
       "    var min_y = Math.min(y0, y1);\n",
       "    var width = Math.abs(x1 - x0);\n",
       "    var height = Math.abs(y1 - y0);\n",
       "\n",
       "    fig.rubberband_context.clearRect(\n",
       "        0, 0, fig.canvas.width / mpl.ratio, fig.canvas.height / mpl.ratio);\n",
       "\n",
       "    fig.rubberband_context.strokeRect(min_x, min_y, width, height);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_figure_label = function(fig, msg) {\n",
       "    // Updates the figure title.\n",
       "    fig.header.textContent = msg['label'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_cursor = function(fig, msg) {\n",
       "    var cursor = msg['cursor'];\n",
       "    switch(cursor)\n",
       "    {\n",
       "    case 0:\n",
       "        cursor = 'pointer';\n",
       "        break;\n",
       "    case 1:\n",
       "        cursor = 'default';\n",
       "        break;\n",
       "    case 2:\n",
       "        cursor = 'crosshair';\n",
       "        break;\n",
       "    case 3:\n",
       "        cursor = 'move';\n",
       "        break;\n",
       "    }\n",
       "    fig.rubberband_canvas.style.cursor = cursor;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_message = function(fig, msg) {\n",
       "    fig.message.textContent = msg['message'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_draw = function(fig, msg) {\n",
       "    // Request the server to send over a new figure.\n",
       "    fig.send_draw_message();\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_image_mode = function(fig, msg) {\n",
       "    fig.image_mode = msg['mode'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.updated_canvas_event = function() {\n",
       "    // Called whenever the canvas gets updated.\n",
       "    this.send_message(\"ack\", {});\n",
       "}\n",
       "\n",
       "// A function to construct a web socket function for onmessage handling.\n",
       "// Called in the figure constructor.\n",
       "mpl.figure.prototype._make_on_message_function = function(fig) {\n",
       "    return function socket_on_message(evt) {\n",
       "        if (evt.data instanceof Blob) {\n",
       "            /* FIXME: We get \"Resource interpreted as Image but\n",
       "             * transferred with MIME type text/plain:\" errors on\n",
       "             * Chrome.  But how to set the MIME type?  It doesn't seem\n",
       "             * to be part of the websocket stream */\n",
       "            evt.data.type = \"image/png\";\n",
       "\n",
       "            /* Free the memory for the previous frames */\n",
       "            if (fig.imageObj.src) {\n",
       "                (window.URL || window.webkitURL).revokeObjectURL(\n",
       "                    fig.imageObj.src);\n",
       "            }\n",
       "\n",
       "            fig.imageObj.src = (window.URL || window.webkitURL).createObjectURL(\n",
       "                evt.data);\n",
       "            fig.updated_canvas_event();\n",
       "            fig.waiting = false;\n",
       "            return;\n",
       "        }\n",
       "        else if (typeof evt.data === 'string' && evt.data.slice(0, 21) == \"data:image/png;base64\") {\n",
       "            fig.imageObj.src = evt.data;\n",
       "            fig.updated_canvas_event();\n",
       "            fig.waiting = false;\n",
       "            return;\n",
       "        }\n",
       "\n",
       "        var msg = JSON.parse(evt.data);\n",
       "        var msg_type = msg['type'];\n",
       "\n",
       "        // Call the  \"handle_{type}\" callback, which takes\n",
       "        // the figure and JSON message as its only arguments.\n",
       "        try {\n",
       "            var callback = fig[\"handle_\" + msg_type];\n",
       "        } catch (e) {\n",
       "            console.log(\"No handler for the '\" + msg_type + \"' message type: \", msg);\n",
       "            return;\n",
       "        }\n",
       "\n",
       "        if (callback) {\n",
       "            try {\n",
       "                // console.log(\"Handling '\" + msg_type + \"' message: \", msg);\n",
       "                callback(fig, msg);\n",
       "            } catch (e) {\n",
       "                console.log(\"Exception inside the 'handler_\" + msg_type + \"' callback:\", e, e.stack, msg);\n",
       "            }\n",
       "        }\n",
       "    };\n",
       "}\n",
       "\n",
       "// from http://stackoverflow.com/questions/1114465/getting-mouse-location-in-canvas\n",
       "mpl.findpos = function(e) {\n",
       "    //this section is from http://www.quirksmode.org/js/events_properties.html\n",
       "    var targ;\n",
       "    if (!e)\n",
       "        e = window.event;\n",
       "    if (e.target)\n",
       "        targ = e.target;\n",
       "    else if (e.srcElement)\n",
       "        targ = e.srcElement;\n",
       "    if (targ.nodeType == 3) // defeat Safari bug\n",
       "        targ = targ.parentNode;\n",
       "\n",
       "    // jQuery normalizes the pageX and pageY\n",
       "    // pageX,Y are the mouse positions relative to the document\n",
       "    // offset() returns the position of the element relative to the document\n",
       "    var x = e.pageX - $(targ).offset().left;\n",
       "    var y = e.pageY - $(targ).offset().top;\n",
       "\n",
       "    return {\"x\": x, \"y\": y};\n",
       "};\n",
       "\n",
       "/*\n",
       " * return a copy of an object with only non-object keys\n",
       " * we need this to avoid circular references\n",
       " * http://stackoverflow.com/a/24161582/3208463\n",
       " */\n",
       "function simpleKeys (original) {\n",
       "  return Object.keys(original).reduce(function (obj, key) {\n",
       "    if (typeof original[key] !== 'object')\n",
       "        obj[key] = original[key]\n",
       "    return obj;\n",
       "  }, {});\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.mouse_event = function(event, name) {\n",
       "    var canvas_pos = mpl.findpos(event)\n",
       "\n",
       "    if (name === 'button_press')\n",
       "    {\n",
       "        this.canvas.focus();\n",
       "        this.canvas_div.focus();\n",
       "    }\n",
       "\n",
       "    var x = canvas_pos.x * mpl.ratio;\n",
       "    var y = canvas_pos.y * mpl.ratio;\n",
       "\n",
       "    this.send_message(name, {x: x, y: y, button: event.button,\n",
       "                             step: event.step,\n",
       "                             guiEvent: simpleKeys(event)});\n",
       "\n",
       "    /* This prevents the web browser from automatically changing to\n",
       "     * the text insertion cursor when the button is pressed.  We want\n",
       "     * to control all of the cursor setting manually through the\n",
       "     * 'cursor' event from matplotlib */\n",
       "    event.preventDefault();\n",
       "    return false;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._key_event_extra = function(event, name) {\n",
       "    // Handle any extra behaviour associated with a key event\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.key_event = function(event, name) {\n",
       "\n",
       "    // Prevent repeat events\n",
       "    if (name == 'key_press')\n",
       "    {\n",
       "        if (event.which === this._key)\n",
       "            return;\n",
       "        else\n",
       "            this._key = event.which;\n",
       "    }\n",
       "    if (name == 'key_release')\n",
       "        this._key = null;\n",
       "\n",
       "    var value = '';\n",
       "    if (event.ctrlKey && event.which != 17)\n",
       "        value += \"ctrl+\";\n",
       "    if (event.altKey && event.which != 18)\n",
       "        value += \"alt+\";\n",
       "    if (event.shiftKey && event.which != 16)\n",
       "        value += \"shift+\";\n",
       "\n",
       "    value += 'k';\n",
       "    value += event.which.toString();\n",
       "\n",
       "    this._key_event_extra(event, name);\n",
       "\n",
       "    this.send_message(name, {key: value,\n",
       "                             guiEvent: simpleKeys(event)});\n",
       "    return false;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.toolbar_button_onclick = function(name) {\n",
       "    if (name == 'download') {\n",
       "        this.handle_save(this, null);\n",
       "    } else {\n",
       "        this.send_message(\"toolbar_button\", {name: name});\n",
       "    }\n",
       "};\n",
       "\n",
       "mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
       "    this.message.textContent = tooltip;\n",
       "};\n",
       "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
       "\n",
       "mpl.extensions = [\"eps\", \"jpeg\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\", \"tif\"];\n",
       "\n",
       "mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
       "    // Create a \"websocket\"-like object which calls the given IPython comm\n",
       "    // object with the appropriate methods. Currently this is a non binary\n",
       "    // socket, so there is still some room for performance tuning.\n",
       "    var ws = {};\n",
       "\n",
       "    ws.close = function() {\n",
       "        comm.close()\n",
       "    };\n",
       "    ws.send = function(m) {\n",
       "        //console.log('sending', m);\n",
       "        comm.send(m);\n",
       "    };\n",
       "    // Register the callback with on_msg.\n",
       "    comm.on_msg(function(msg) {\n",
       "        //console.log('receiving', msg['content']['data'], msg);\n",
       "        // Pass the mpl event to the overridden (by mpl) onmessage function.\n",
       "        ws.onmessage(msg['content']['data'])\n",
       "    });\n",
       "    return ws;\n",
       "}\n",
       "\n",
       "mpl.mpl_figure_comm = function(comm, msg) {\n",
       "    // This is the function which gets called when the mpl process\n",
       "    // starts-up an IPython Comm through the \"matplotlib\" channel.\n",
       "\n",
       "    var id = msg.content.data.id;\n",
       "    // Get hold of the div created by the display call when the Comm\n",
       "    // socket was opened in Python.\n",
       "    var element = $(\"#\" + id);\n",
       "    var ws_proxy = comm_websocket_adapter(comm)\n",
       "\n",
       "    function ondownload(figure, format) {\n",
       "        window.open(figure.imageObj.src);\n",
       "    }\n",
       "\n",
       "    var fig = new mpl.figure(id, ws_proxy,\n",
       "                           ondownload,\n",
       "                           element.get(0));\n",
       "\n",
       "    // Call onopen now - mpl needs it, as it is assuming we've passed it a real\n",
       "    // web socket which is closed, not our websocket->open comm proxy.\n",
       "    ws_proxy.onopen();\n",
       "\n",
       "    fig.parent_element = element.get(0);\n",
       "    fig.cell_info = mpl.find_output_cell(\"<div id='\" + id + \"'></div>\");\n",
       "    if (!fig.cell_info) {\n",
       "        console.error(\"Failed to find cell for figure\", id, fig);\n",
       "        return;\n",
       "    }\n",
       "\n",
       "    var output_index = fig.cell_info[2]\n",
       "    var cell = fig.cell_info[0];\n",
       "\n",
       "};\n",
       "\n",
       "mpl.figure.prototype.handle_close = function(fig, msg) {\n",
       "    var width = fig.canvas.width/mpl.ratio\n",
       "    fig.root.unbind('remove')\n",
       "\n",
       "    // Update the output cell to use the data from the current canvas.\n",
       "    fig.push_to_output();\n",
       "    var dataURL = fig.canvas.toDataURL();\n",
       "    // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
       "    // the notebook keyboard shortcuts fail.\n",
       "    IPython.keyboard_manager.enable()\n",
       "    $(fig.parent_element).html('<img src=\"' + dataURL + '\" width=\"' + width + '\">');\n",
       "    fig.close_ws(fig, msg);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.close_ws = function(fig, msg){\n",
       "    fig.send_message('closing', msg);\n",
       "    // fig.ws.close()\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
       "    // Turn the data on the canvas into data in the output cell.\n",
       "    var width = this.canvas.width/mpl.ratio\n",
       "    var dataURL = this.canvas.toDataURL();\n",
       "    this.cell_info[1]['text/html'] = '<img src=\"' + dataURL + '\" width=\"' + width + '\">';\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.updated_canvas_event = function() {\n",
       "    // Tell IPython that the notebook contents must change.\n",
       "    IPython.notebook.set_dirty(true);\n",
       "    this.send_message(\"ack\", {});\n",
       "    var fig = this;\n",
       "    // Wait a second, then push the new image to the DOM so\n",
       "    // that it is saved nicely (might be nice to debounce this).\n",
       "    setTimeout(function () { fig.push_to_output() }, 1000);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_toolbar = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var nav_element = $('<div/>');\n",
       "    nav_element.attr('style', 'width: 100%');\n",
       "    this.root.append(nav_element);\n",
       "\n",
       "    // Define a callback function for later on.\n",
       "    function toolbar_event(event) {\n",
       "        return fig.toolbar_button_onclick(event['data']);\n",
       "    }\n",
       "    function toolbar_mouse_event(event) {\n",
       "        return fig.toolbar_button_onmouseover(event['data']);\n",
       "    }\n",
       "\n",
       "    for(var toolbar_ind in mpl.toolbar_items){\n",
       "        var name = mpl.toolbar_items[toolbar_ind][0];\n",
       "        var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
       "        var image = mpl.toolbar_items[toolbar_ind][2];\n",
       "        var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
       "\n",
       "        if (!name) { continue; };\n",
       "\n",
       "        var button = $('<button class=\"btn btn-default\" href=\"#\" title=\"' + name + '\"><i class=\"fa ' + image + ' fa-lg\"></i></button>');\n",
       "        button.click(method_name, toolbar_event);\n",
       "        button.mouseover(tooltip, toolbar_mouse_event);\n",
       "        nav_element.append(button);\n",
       "    }\n",
       "\n",
       "    // Add the status bar.\n",
       "    var status_bar = $('<span class=\"mpl-message\" style=\"text-align:right; float: right;\"/>');\n",
       "    nav_element.append(status_bar);\n",
       "    this.message = status_bar[0];\n",
       "\n",
       "    // Add the close button to the window.\n",
       "    var buttongrp = $('<div class=\"btn-group inline pull-right\"></div>');\n",
       "    var button = $('<button class=\"btn btn-mini btn-primary\" href=\"#\" title=\"Stop Interaction\"><i class=\"fa fa-power-off icon-remove icon-large\"></i></button>');\n",
       "    button.click(function (evt) { fig.handle_close(fig, {}); } );\n",
       "    button.mouseover('Stop Interaction', toolbar_mouse_event);\n",
       "    buttongrp.append(button);\n",
       "    var titlebar = this.root.find($('.ui-dialog-titlebar'));\n",
       "    titlebar.prepend(buttongrp);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._root_extra_style = function(el){\n",
       "    var fig = this\n",
       "    el.on(\"remove\", function(){\n",
       "\tfig.close_ws(fig, {});\n",
       "    });\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._canvas_extra_style = function(el){\n",
       "    // this is important to make the div 'focusable\n",
       "    el.attr('tabindex', 0)\n",
       "    // reach out to IPython and tell the keyboard manager to turn it's self\n",
       "    // off when our div gets focus\n",
       "\n",
       "    // location in version 3\n",
       "    if (IPython.notebook.keyboard_manager) {\n",
       "        IPython.notebook.keyboard_manager.register_events(el);\n",
       "    }\n",
       "    else {\n",
       "        // location in version 2\n",
       "        IPython.keyboard_manager.register_events(el);\n",
       "    }\n",
       "\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._key_event_extra = function(event, name) {\n",
       "    var manager = IPython.notebook.keyboard_manager;\n",
       "    if (!manager)\n",
       "        manager = IPython.keyboard_manager;\n",
       "\n",
       "    // Check for shift+enter\n",
       "    if (event.shiftKey && event.which == 13) {\n",
       "        this.canvas_div.blur();\n",
       "        event.shiftKey = false;\n",
       "        // Send a \"J\" for go to next cell\n",
       "        event.which = 74;\n",
       "        event.keyCode = 74;\n",
       "        manager.command_mode();\n",
       "        manager.handle_keydown(event);\n",
       "    }\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_save = function(fig, msg) {\n",
       "    fig.ondownload(fig, null);\n",
       "}\n",
       "\n",
       "\n",
       "mpl.find_output_cell = function(html_output) {\n",
       "    // Return the cell and output element which can be found *uniquely* in the notebook.\n",
       "    // Note - this is a bit hacky, but it is done because the \"notebook_saving.Notebook\"\n",
       "    // IPython event is triggered only after the cells have been serialised, which for\n",
       "    // our purposes (turning an active figure into a static one), is too late.\n",
       "    var cells = IPython.notebook.get_cells();\n",
       "    var ncells = cells.length;\n",
       "    for (var i=0; i<ncells; i++) {\n",
       "        var cell = cells[i];\n",
       "        if (cell.cell_type === 'code'){\n",
       "            for (var j=0; j<cell.output_area.outputs.length; j++) {\n",
       "                var data = cell.output_area.outputs[j];\n",
       "                if (data.data) {\n",
       "                    // IPython >= 3 moved mimebundle to data attribute of output\n",
       "                    data = data.data;\n",
       "                }\n",
       "                if (data['text/html'] == html_output) {\n",
       "                    return [cell, data, j];\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    }\n",
       "}\n",
       "\n",
       "// Register the function which deals with the matplotlib target/channel.\n",
       "// The kernel may be null if the page has been refreshed.\n",
       "if (IPython.notebook.kernel != null) {\n",
       "    IPython.notebook.kernel.comm_manager.register_target('matplotlib', mpl.mpl_figure_comm);\n",
       "}\n"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<img src=\"\" width=\"639.9999861283738\">"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "/* Put everything inside the global mpl namespace */\n",
       "window.mpl = {};\n",
       "\n",
       "\n",
       "mpl.get_websocket_type = function() {\n",
       "    if (typeof(WebSocket) !== 'undefined') {\n",
       "        return WebSocket;\n",
       "    } else if (typeof(MozWebSocket) !== 'undefined') {\n",
       "        return MozWebSocket;\n",
       "    } else {\n",
       "        alert('Your browser does not have WebSocket support. ' +\n",
       "              'Please try Chrome, Safari or Firefox ≥ 6. ' +\n",
       "              'Firefox 4 and 5 are also supported but you ' +\n",
       "              'have to enable WebSockets in about:config.');\n",
       "    };\n",
       "}\n",
       "\n",
       "mpl.figure = function(figure_id, websocket, ondownload, parent_element) {\n",
       "    this.id = figure_id;\n",
       "\n",
       "    this.ws = websocket;\n",
       "\n",
       "    this.supports_binary = (this.ws.binaryType != undefined);\n",
       "\n",
       "    if (!this.supports_binary) {\n",
       "        var warnings = document.getElementById(\"mpl-warnings\");\n",
       "        if (warnings) {\n",
       "            warnings.style.display = 'block';\n",
       "            warnings.textContent = (\n",
       "                \"This browser does not support binary websocket messages. \" +\n",
       "                    \"Performance may be slow.\");\n",
       "        }\n",
       "    }\n",
       "\n",
       "    this.imageObj = new Image();\n",
       "\n",
       "    this.context = undefined;\n",
       "    this.message = undefined;\n",
       "    this.canvas = undefined;\n",
       "    this.rubberband_canvas = undefined;\n",
       "    this.rubberband_context = undefined;\n",
       "    this.format_dropdown = undefined;\n",
       "\n",
       "    this.image_mode = 'full';\n",
       "\n",
       "    this.root = $('<div/>');\n",
       "    this._root_extra_style(this.root)\n",
       "    this.root.attr('style', 'display: inline-block');\n",
       "\n",
       "    $(parent_element).append(this.root);\n",
       "\n",
       "    this._init_header(this);\n",
       "    this._init_canvas(this);\n",
       "    this._init_toolbar(this);\n",
       "\n",
       "    var fig = this;\n",
       "\n",
       "    this.waiting = false;\n",
       "\n",
       "    this.ws.onopen =  function () {\n",
       "            fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
       "            fig.send_message(\"send_image_mode\", {});\n",
       "            if (mpl.ratio != 1) {\n",
       "                fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n",
       "            }\n",
       "            fig.send_message(\"refresh\", {});\n",
       "        }\n",
       "\n",
       "    this.imageObj.onload = function() {\n",
       "            if (fig.image_mode == 'full') {\n",
       "                // Full images could contain transparency (where diff images\n",
       "                // almost always do), so we need to clear the canvas so that\n",
       "                // there is no ghosting.\n",
       "                fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n",
       "            }\n",
       "            fig.context.drawImage(fig.imageObj, 0, 0);\n",
       "        };\n",
       "\n",
       "    this.imageObj.onunload = function() {\n",
       "        fig.ws.close();\n",
       "    }\n",
       "\n",
       "    this.ws.onmessage = this._make_on_message_function(this);\n",
       "\n",
       "    this.ondownload = ondownload;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_header = function() {\n",
       "    var titlebar = $(\n",
       "        '<div class=\"ui-dialog-titlebar ui-widget-header ui-corner-all ' +\n",
       "        'ui-helper-clearfix\"/>');\n",
       "    var titletext = $(\n",
       "        '<div class=\"ui-dialog-title\" style=\"width: 100%; ' +\n",
       "        'text-align: center; padding: 3px;\"/>');\n",
       "    titlebar.append(titletext)\n",
       "    this.root.append(titlebar);\n",
       "    this.header = titletext[0];\n",
       "}\n",
       "\n",
       "\n",
       "\n",
       "mpl.figure.prototype._canvas_extra_style = function(canvas_div) {\n",
       "\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype._root_extra_style = function(canvas_div) {\n",
       "\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_canvas = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var canvas_div = $('<div/>');\n",
       "\n",
       "    canvas_div.attr('style', 'position: relative; clear: both; outline: 0');\n",
       "\n",
       "    function canvas_keyboard_event(event) {\n",
       "        return fig.key_event(event, event['data']);\n",
       "    }\n",
       "\n",
       "    canvas_div.keydown('key_press', canvas_keyboard_event);\n",
       "    canvas_div.keyup('key_release', canvas_keyboard_event);\n",
       "    this.canvas_div = canvas_div\n",
       "    this._canvas_extra_style(canvas_div)\n",
       "    this.root.append(canvas_div);\n",
       "\n",
       "    var canvas = $('<canvas/>');\n",
       "    canvas.addClass('mpl-canvas');\n",
       "    canvas.attr('style', \"left: 0; top: 0; z-index: 0; outline: 0\")\n",
       "\n",
       "    this.canvas = canvas[0];\n",
       "    this.context = canvas[0].getContext(\"2d\");\n",
       "\n",
       "    var backingStore = this.context.backingStorePixelRatio ||\n",
       "\tthis.context.webkitBackingStorePixelRatio ||\n",
       "\tthis.context.mozBackingStorePixelRatio ||\n",
       "\tthis.context.msBackingStorePixelRatio ||\n",
       "\tthis.context.oBackingStorePixelRatio ||\n",
       "\tthis.context.backingStorePixelRatio || 1;\n",
       "\n",
       "    mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n",
       "\n",
       "    var rubberband = $('<canvas/>');\n",
       "    rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
       "\n",
       "    var pass_mouse_events = true;\n",
       "\n",
       "    canvas_div.resizable({\n",
       "        start: function(event, ui) {\n",
       "            pass_mouse_events = false;\n",
       "        },\n",
       "        resize: function(event, ui) {\n",
       "            fig.request_resize(ui.size.width, ui.size.height);\n",
       "        },\n",
       "        stop: function(event, ui) {\n",
       "            pass_mouse_events = true;\n",
       "            fig.request_resize(ui.size.width, ui.size.height);\n",
       "        },\n",
       "    });\n",
       "\n",
       "    function mouse_event_fn(event) {\n",
       "        if (pass_mouse_events)\n",
       "            return fig.mouse_event(event, event['data']);\n",
       "    }\n",
       "\n",
       "    rubberband.mousedown('button_press', mouse_event_fn);\n",
       "    rubberband.mouseup('button_release', mouse_event_fn);\n",
       "    // Throttle sequential mouse events to 1 every 20ms.\n",
       "    rubberband.mousemove('motion_notify', mouse_event_fn);\n",
       "\n",
       "    rubberband.mouseenter('figure_enter', mouse_event_fn);\n",
       "    rubberband.mouseleave('figure_leave', mouse_event_fn);\n",
       "\n",
       "    canvas_div.on(\"wheel\", function (event) {\n",
       "        event = event.originalEvent;\n",
       "        event['data'] = 'scroll'\n",
       "        if (event.deltaY < 0) {\n",
       "            event.step = 1;\n",
       "        } else {\n",
       "            event.step = -1;\n",
       "        }\n",
       "        mouse_event_fn(event);\n",
       "    });\n",
       "\n",
       "    canvas_div.append(canvas);\n",
       "    canvas_div.append(rubberband);\n",
       "\n",
       "    this.rubberband = rubberband;\n",
       "    this.rubberband_canvas = rubberband[0];\n",
       "    this.rubberband_context = rubberband[0].getContext(\"2d\");\n",
       "    this.rubberband_context.strokeStyle = \"#000000\";\n",
       "\n",
       "    this._resize_canvas = function(width, height) {\n",
       "        // Keep the size of the canvas, canvas container, and rubber band\n",
       "        // canvas in synch.\n",
       "        canvas_div.css('width', width)\n",
       "        canvas_div.css('height', height)\n",
       "\n",
       "        canvas.attr('width', width * mpl.ratio);\n",
       "        canvas.attr('height', height * mpl.ratio);\n",
       "        canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n",
       "\n",
       "        rubberband.attr('width', width);\n",
       "        rubberband.attr('height', height);\n",
       "    }\n",
       "\n",
       "    // Set the figure to an initial 600x600px, this will subsequently be updated\n",
       "    // upon first draw.\n",
       "    this._resize_canvas(600, 600);\n",
       "\n",
       "    // Disable right mouse context menu.\n",
       "    $(this.rubberband_canvas).bind(\"contextmenu\",function(e){\n",
       "        return false;\n",
       "    });\n",
       "\n",
       "    function set_focus () {\n",
       "        canvas.focus();\n",
       "        canvas_div.focus();\n",
       "    }\n",
       "\n",
       "    window.setTimeout(set_focus, 100);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_toolbar = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var nav_element = $('<div/>');\n",
       "    nav_element.attr('style', 'width: 100%');\n",
       "    this.root.append(nav_element);\n",
       "\n",
       "    // Define a callback function for later on.\n",
       "    function toolbar_event(event) {\n",
       "        return fig.toolbar_button_onclick(event['data']);\n",
       "    }\n",
       "    function toolbar_mouse_event(event) {\n",
       "        return fig.toolbar_button_onmouseover(event['data']);\n",
       "    }\n",
       "\n",
       "    for(var toolbar_ind in mpl.toolbar_items) {\n",
       "        var name = mpl.toolbar_items[toolbar_ind][0];\n",
       "        var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
       "        var image = mpl.toolbar_items[toolbar_ind][2];\n",
       "        var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
       "\n",
       "        if (!name) {\n",
       "            // put a spacer in here.\n",
       "            continue;\n",
       "        }\n",
       "        var button = $('<button/>');\n",
       "        button.addClass('ui-button ui-widget ui-state-default ui-corner-all ' +\n",
       "                        'ui-button-icon-only');\n",
       "        button.attr('role', 'button');\n",
       "        button.attr('aria-disabled', 'false');\n",
       "        button.click(method_name, toolbar_event);\n",
       "        button.mouseover(tooltip, toolbar_mouse_event);\n",
       "\n",
       "        var icon_img = $('<span/>');\n",
       "        icon_img.addClass('ui-button-icon-primary ui-icon');\n",
       "        icon_img.addClass(image);\n",
       "        icon_img.addClass('ui-corner-all');\n",
       "\n",
       "        var tooltip_span = $('<span/>');\n",
       "        tooltip_span.addClass('ui-button-text');\n",
       "        tooltip_span.html(tooltip);\n",
       "\n",
       "        button.append(icon_img);\n",
       "        button.append(tooltip_span);\n",
       "\n",
       "        nav_element.append(button);\n",
       "    }\n",
       "\n",
       "    var fmt_picker_span = $('<span/>');\n",
       "\n",
       "    var fmt_picker = $('<select/>');\n",
       "    fmt_picker.addClass('mpl-toolbar-option ui-widget ui-widget-content');\n",
       "    fmt_picker_span.append(fmt_picker);\n",
       "    nav_element.append(fmt_picker_span);\n",
       "    this.format_dropdown = fmt_picker[0];\n",
       "\n",
       "    for (var ind in mpl.extensions) {\n",
       "        var fmt = mpl.extensions[ind];\n",
       "        var option = $(\n",
       "            '<option/>', {selected: fmt === mpl.default_extension}).html(fmt);\n",
       "        fmt_picker.append(option);\n",
       "    }\n",
       "\n",
       "    // Add hover states to the ui-buttons\n",
       "    $( \".ui-button\" ).hover(\n",
       "        function() { $(this).addClass(\"ui-state-hover\");},\n",
       "        function() { $(this).removeClass(\"ui-state-hover\");}\n",
       "    );\n",
       "\n",
       "    var status_bar = $('<span class=\"mpl-message\"/>');\n",
       "    nav_element.append(status_bar);\n",
       "    this.message = status_bar[0];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.request_resize = function(x_pixels, y_pixels) {\n",
       "    // Request matplotlib to resize the figure. Matplotlib will then trigger a resize in the client,\n",
       "    // which will in turn request a refresh of the image.\n",
       "    this.send_message('resize', {'width': x_pixels, 'height': y_pixels});\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.send_message = function(type, properties) {\n",
       "    properties['type'] = type;\n",
       "    properties['figure_id'] = this.id;\n",
       "    this.ws.send(JSON.stringify(properties));\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.send_draw_message = function() {\n",
       "    if (!this.waiting) {\n",
       "        this.waiting = true;\n",
       "        this.ws.send(JSON.stringify({type: \"draw\", figure_id: this.id}));\n",
       "    }\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype.handle_save = function(fig, msg) {\n",
       "    var format_dropdown = fig.format_dropdown;\n",
       "    var format = format_dropdown.options[format_dropdown.selectedIndex].value;\n",
       "    fig.ondownload(fig, format);\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype.handle_resize = function(fig, msg) {\n",
       "    var size = msg['size'];\n",
       "    if (size[0] != fig.canvas.width || size[1] != fig.canvas.height) {\n",
       "        fig._resize_canvas(size[0], size[1]);\n",
       "        fig.send_message(\"refresh\", {});\n",
       "    };\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
       "    var x0 = msg['x0'] / mpl.ratio;\n",
       "    var y0 = (fig.canvas.height - msg['y0']) / mpl.ratio;\n",
       "    var x1 = msg['x1'] / mpl.ratio;\n",
       "    var y1 = (fig.canvas.height - msg['y1']) / mpl.ratio;\n",
       "    x0 = Math.floor(x0) + 0.5;\n",
       "    y0 = Math.floor(y0) + 0.5;\n",
       "    x1 = Math.floor(x1) + 0.5;\n",
       "    y1 = Math.floor(y1) + 0.5;\n",
       "    var min_x = Math.min(x0, x1);\n",
       "    var min_y = Math.min(y0, y1);\n",
       "    var width = Math.abs(x1 - x0);\n",
       "    var height = Math.abs(y1 - y0);\n",
       "\n",
       "    fig.rubberband_context.clearRect(\n",
       "        0, 0, fig.canvas.width / mpl.ratio, fig.canvas.height / mpl.ratio);\n",
       "\n",
       "    fig.rubberband_context.strokeRect(min_x, min_y, width, height);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_figure_label = function(fig, msg) {\n",
       "    // Updates the figure title.\n",
       "    fig.header.textContent = msg['label'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_cursor = function(fig, msg) {\n",
       "    var cursor = msg['cursor'];\n",
       "    switch(cursor)\n",
       "    {\n",
       "    case 0:\n",
       "        cursor = 'pointer';\n",
       "        break;\n",
       "    case 1:\n",
       "        cursor = 'default';\n",
       "        break;\n",
       "    case 2:\n",
       "        cursor = 'crosshair';\n",
       "        break;\n",
       "    case 3:\n",
       "        cursor = 'move';\n",
       "        break;\n",
       "    }\n",
       "    fig.rubberband_canvas.style.cursor = cursor;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_message = function(fig, msg) {\n",
       "    fig.message.textContent = msg['message'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_draw = function(fig, msg) {\n",
       "    // Request the server to send over a new figure.\n",
       "    fig.send_draw_message();\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_image_mode = function(fig, msg) {\n",
       "    fig.image_mode = msg['mode'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.updated_canvas_event = function() {\n",
       "    // Called whenever the canvas gets updated.\n",
       "    this.send_message(\"ack\", {});\n",
       "}\n",
       "\n",
       "// A function to construct a web socket function for onmessage handling.\n",
       "// Called in the figure constructor.\n",
       "mpl.figure.prototype._make_on_message_function = function(fig) {\n",
       "    return function socket_on_message(evt) {\n",
       "        if (evt.data instanceof Blob) {\n",
       "            /* FIXME: We get \"Resource interpreted as Image but\n",
       "             * transferred with MIME type text/plain:\" errors on\n",
       "             * Chrome.  But how to set the MIME type?  It doesn't seem\n",
       "             * to be part of the websocket stream */\n",
       "            evt.data.type = \"image/png\";\n",
       "\n",
       "            /* Free the memory for the previous frames */\n",
       "            if (fig.imageObj.src) {\n",
       "                (window.URL || window.webkitURL).revokeObjectURL(\n",
       "                    fig.imageObj.src);\n",
       "            }\n",
       "\n",
       "            fig.imageObj.src = (window.URL || window.webkitURL).createObjectURL(\n",
       "                evt.data);\n",
       "            fig.updated_canvas_event();\n",
       "            fig.waiting = false;\n",
       "            return;\n",
       "        }\n",
       "        else if (typeof evt.data === 'string' && evt.data.slice(0, 21) == \"data:image/png;base64\") {\n",
       "            fig.imageObj.src = evt.data;\n",
       "            fig.updated_canvas_event();\n",
       "            fig.waiting = false;\n",
       "            return;\n",
       "        }\n",
       "\n",
       "        var msg = JSON.parse(evt.data);\n",
       "        var msg_type = msg['type'];\n",
       "\n",
       "        // Call the  \"handle_{type}\" callback, which takes\n",
       "        // the figure and JSON message as its only arguments.\n",
       "        try {\n",
       "            var callback = fig[\"handle_\" + msg_type];\n",
       "        } catch (e) {\n",
       "            console.log(\"No handler for the '\" + msg_type + \"' message type: \", msg);\n",
       "            return;\n",
       "        }\n",
       "\n",
       "        if (callback) {\n",
       "            try {\n",
       "                // console.log(\"Handling '\" + msg_type + \"' message: \", msg);\n",
       "                callback(fig, msg);\n",
       "            } catch (e) {\n",
       "                console.log(\"Exception inside the 'handler_\" + msg_type + \"' callback:\", e, e.stack, msg);\n",
       "            }\n",
       "        }\n",
       "    };\n",
       "}\n",
       "\n",
       "// from http://stackoverflow.com/questions/1114465/getting-mouse-location-in-canvas\n",
       "mpl.findpos = function(e) {\n",
       "    //this section is from http://www.quirksmode.org/js/events_properties.html\n",
       "    var targ;\n",
       "    if (!e)\n",
       "        e = window.event;\n",
       "    if (e.target)\n",
       "        targ = e.target;\n",
       "    else if (e.srcElement)\n",
       "        targ = e.srcElement;\n",
       "    if (targ.nodeType == 3) // defeat Safari bug\n",
       "        targ = targ.parentNode;\n",
       "\n",
       "    // jQuery normalizes the pageX and pageY\n",
       "    // pageX,Y are the mouse positions relative to the document\n",
       "    // offset() returns the position of the element relative to the document\n",
       "    var x = e.pageX - $(targ).offset().left;\n",
       "    var y = e.pageY - $(targ).offset().top;\n",
       "\n",
       "    return {\"x\": x, \"y\": y};\n",
       "};\n",
       "\n",
       "/*\n",
       " * return a copy of an object with only non-object keys\n",
       " * we need this to avoid circular references\n",
       " * http://stackoverflow.com/a/24161582/3208463\n",
       " */\n",
       "function simpleKeys (original) {\n",
       "  return Object.keys(original).reduce(function (obj, key) {\n",
       "    if (typeof original[key] !== 'object')\n",
       "        obj[key] = original[key]\n",
       "    return obj;\n",
       "  }, {});\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.mouse_event = function(event, name) {\n",
       "    var canvas_pos = mpl.findpos(event)\n",
       "\n",
       "    if (name === 'button_press')\n",
       "    {\n",
       "        this.canvas.focus();\n",
       "        this.canvas_div.focus();\n",
       "    }\n",
       "\n",
       "    var x = canvas_pos.x * mpl.ratio;\n",
       "    var y = canvas_pos.y * mpl.ratio;\n",
       "\n",
       "    this.send_message(name, {x: x, y: y, button: event.button,\n",
       "                             step: event.step,\n",
       "                             guiEvent: simpleKeys(event)});\n",
       "\n",
       "    /* This prevents the web browser from automatically changing to\n",
       "     * the text insertion cursor when the button is pressed.  We want\n",
       "     * to control all of the cursor setting manually through the\n",
       "     * 'cursor' event from matplotlib */\n",
       "    event.preventDefault();\n",
       "    return false;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._key_event_extra = function(event, name) {\n",
       "    // Handle any extra behaviour associated with a key event\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.key_event = function(event, name) {\n",
       "\n",
       "    // Prevent repeat events\n",
       "    if (name == 'key_press')\n",
       "    {\n",
       "        if (event.which === this._key)\n",
       "            return;\n",
       "        else\n",
       "            this._key = event.which;\n",
       "    }\n",
       "    if (name == 'key_release')\n",
       "        this._key = null;\n",
       "\n",
       "    var value = '';\n",
       "    if (event.ctrlKey && event.which != 17)\n",
       "        value += \"ctrl+\";\n",
       "    if (event.altKey && event.which != 18)\n",
       "        value += \"alt+\";\n",
       "    if (event.shiftKey && event.which != 16)\n",
       "        value += \"shift+\";\n",
       "\n",
       "    value += 'k';\n",
       "    value += event.which.toString();\n",
       "\n",
       "    this._key_event_extra(event, name);\n",
       "\n",
       "    this.send_message(name, {key: value,\n",
       "                             guiEvent: simpleKeys(event)});\n",
       "    return false;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.toolbar_button_onclick = function(name) {\n",
       "    if (name == 'download') {\n",
       "        this.handle_save(this, null);\n",
       "    } else {\n",
       "        this.send_message(\"toolbar_button\", {name: name});\n",
       "    }\n",
       "};\n",
       "\n",
       "mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
       "    this.message.textContent = tooltip;\n",
       "};\n",
       "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
       "\n",
       "mpl.extensions = [\"eps\", \"jpeg\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\", \"tif\"];\n",
       "\n",
       "mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
       "    // Create a \"websocket\"-like object which calls the given IPython comm\n",
       "    // object with the appropriate methods. Currently this is a non binary\n",
       "    // socket, so there is still some room for performance tuning.\n",
       "    var ws = {};\n",
       "\n",
       "    ws.close = function() {\n",
       "        comm.close()\n",
       "    };\n",
       "    ws.send = function(m) {\n",
       "        //console.log('sending', m);\n",
       "        comm.send(m);\n",
       "    };\n",
       "    // Register the callback with on_msg.\n",
       "    comm.on_msg(function(msg) {\n",
       "        //console.log('receiving', msg['content']['data'], msg);\n",
       "        // Pass the mpl event to the overridden (by mpl) onmessage function.\n",
       "        ws.onmessage(msg['content']['data'])\n",
       "    });\n",
       "    return ws;\n",
       "}\n",
       "\n",
       "mpl.mpl_figure_comm = function(comm, msg) {\n",
       "    // This is the function which gets called when the mpl process\n",
       "    // starts-up an IPython Comm through the \"matplotlib\" channel.\n",
       "\n",
       "    var id = msg.content.data.id;\n",
       "    // Get hold of the div created by the display call when the Comm\n",
       "    // socket was opened in Python.\n",
       "    var element = $(\"#\" + id);\n",
       "    var ws_proxy = comm_websocket_adapter(comm)\n",
       "\n",
       "    function ondownload(figure, format) {\n",
       "        window.open(figure.imageObj.src);\n",
       "    }\n",
       "\n",
       "    var fig = new mpl.figure(id, ws_proxy,\n",
       "                           ondownload,\n",
       "                           element.get(0));\n",
       "\n",
       "    // Call onopen now - mpl needs it, as it is assuming we've passed it a real\n",
       "    // web socket which is closed, not our websocket->open comm proxy.\n",
       "    ws_proxy.onopen();\n",
       "\n",
       "    fig.parent_element = element.get(0);\n",
       "    fig.cell_info = mpl.find_output_cell(\"<div id='\" + id + \"'></div>\");\n",
       "    if (!fig.cell_info) {\n",
       "        console.error(\"Failed to find cell for figure\", id, fig);\n",
       "        return;\n",
       "    }\n",
       "\n",
       "    var output_index = fig.cell_info[2]\n",
       "    var cell = fig.cell_info[0];\n",
       "\n",
       "};\n",
       "\n",
       "mpl.figure.prototype.handle_close = function(fig, msg) {\n",
       "    var width = fig.canvas.width/mpl.ratio\n",
       "    fig.root.unbind('remove')\n",
       "\n",
       "    // Update the output cell to use the data from the current canvas.\n",
       "    fig.push_to_output();\n",
       "    var dataURL = fig.canvas.toDataURL();\n",
       "    // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
       "    // the notebook keyboard shortcuts fail.\n",
       "    IPython.keyboard_manager.enable()\n",
       "    $(fig.parent_element).html('<img src=\"' + dataURL + '\" width=\"' + width + '\">');\n",
       "    fig.close_ws(fig, msg);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.close_ws = function(fig, msg){\n",
       "    fig.send_message('closing', msg);\n",
       "    // fig.ws.close()\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
       "    // Turn the data on the canvas into data in the output cell.\n",
       "    var width = this.canvas.width/mpl.ratio\n",
       "    var dataURL = this.canvas.toDataURL();\n",
       "    this.cell_info[1]['text/html'] = '<img src=\"' + dataURL + '\" width=\"' + width + '\">';\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.updated_canvas_event = function() {\n",
       "    // Tell IPython that the notebook contents must change.\n",
       "    IPython.notebook.set_dirty(true);\n",
       "    this.send_message(\"ack\", {});\n",
       "    var fig = this;\n",
       "    // Wait a second, then push the new image to the DOM so\n",
       "    // that it is saved nicely (might be nice to debounce this).\n",
       "    setTimeout(function () { fig.push_to_output() }, 1000);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_toolbar = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var nav_element = $('<div/>');\n",
       "    nav_element.attr('style', 'width: 100%');\n",
       "    this.root.append(nav_element);\n",
       "\n",
       "    // Define a callback function for later on.\n",
       "    function toolbar_event(event) {\n",
       "        return fig.toolbar_button_onclick(event['data']);\n",
       "    }\n",
       "    function toolbar_mouse_event(event) {\n",
       "        return fig.toolbar_button_onmouseover(event['data']);\n",
       "    }\n",
       "\n",
       "    for(var toolbar_ind in mpl.toolbar_items){\n",
       "        var name = mpl.toolbar_items[toolbar_ind][0];\n",
       "        var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
       "        var image = mpl.toolbar_items[toolbar_ind][2];\n",
       "        var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
       "\n",
       "        if (!name) { continue; };\n",
       "\n",
       "        var button = $('<button class=\"btn btn-default\" href=\"#\" title=\"' + name + '\"><i class=\"fa ' + image + ' fa-lg\"></i></button>');\n",
       "        button.click(method_name, toolbar_event);\n",
       "        button.mouseover(tooltip, toolbar_mouse_event);\n",
       "        nav_element.append(button);\n",
       "    }\n",
       "\n",
       "    // Add the status bar.\n",
       "    var status_bar = $('<span class=\"mpl-message\" style=\"text-align:right; float: right;\"/>');\n",
       "    nav_element.append(status_bar);\n",
       "    this.message = status_bar[0];\n",
       "\n",
       "    // Add the close button to the window.\n",
       "    var buttongrp = $('<div class=\"btn-group inline pull-right\"></div>');\n",
       "    var button = $('<button class=\"btn btn-mini btn-primary\" href=\"#\" title=\"Stop Interaction\"><i class=\"fa fa-power-off icon-remove icon-large\"></i></button>');\n",
       "    button.click(function (evt) { fig.handle_close(fig, {}); } );\n",
       "    button.mouseover('Stop Interaction', toolbar_mouse_event);\n",
       "    buttongrp.append(button);\n",
       "    var titlebar = this.root.find($('.ui-dialog-titlebar'));\n",
       "    titlebar.prepend(buttongrp);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._root_extra_style = function(el){\n",
       "    var fig = this\n",
       "    el.on(\"remove\", function(){\n",
       "\tfig.close_ws(fig, {});\n",
       "    });\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._canvas_extra_style = function(el){\n",
       "    // this is important to make the div 'focusable\n",
       "    el.attr('tabindex', 0)\n",
       "    // reach out to IPython and tell the keyboard manager to turn it's self\n",
       "    // off when our div gets focus\n",
       "\n",
       "    // location in version 3\n",
       "    if (IPython.notebook.keyboard_manager) {\n",
       "        IPython.notebook.keyboard_manager.register_events(el);\n",
       "    }\n",
       "    else {\n",
       "        // location in version 2\n",
       "        IPython.keyboard_manager.register_events(el);\n",
       "    }\n",
       "\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._key_event_extra = function(event, name) {\n",
       "    var manager = IPython.notebook.keyboard_manager;\n",
       "    if (!manager)\n",
       "        manager = IPython.keyboard_manager;\n",
       "\n",
       "    // Check for shift+enter\n",
       "    if (event.shiftKey && event.which == 13) {\n",
       "        this.canvas_div.blur();\n",
       "        event.shiftKey = false;\n",
       "        // Send a \"J\" for go to next cell\n",
       "        event.which = 74;\n",
       "        event.keyCode = 74;\n",
       "        manager.command_mode();\n",
       "        manager.handle_keydown(event);\n",
       "    }\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_save = function(fig, msg) {\n",
       "    fig.ondownload(fig, null);\n",
       "}\n",
       "\n",
       "\n",
       "mpl.find_output_cell = function(html_output) {\n",
       "    // Return the cell and output element which can be found *uniquely* in the notebook.\n",
       "    // Note - this is a bit hacky, but it is done because the \"notebook_saving.Notebook\"\n",
       "    // IPython event is triggered only after the cells have been serialised, which for\n",
       "    // our purposes (turning an active figure into a static one), is too late.\n",
       "    var cells = IPython.notebook.get_cells();\n",
       "    var ncells = cells.length;\n",
       "    for (var i=0; i<ncells; i++) {\n",
       "        var cell = cells[i];\n",
       "        if (cell.cell_type === 'code'){\n",
       "            for (var j=0; j<cell.output_area.outputs.length; j++) {\n",
       "                var data = cell.output_area.outputs[j];\n",
       "                if (data.data) {\n",
       "                    // IPython >= 3 moved mimebundle to data attribute of output\n",
       "                    data = data.data;\n",
       "                }\n",
       "                if (data['text/html'] == html_output) {\n",
       "                    return [cell, data, j];\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    }\n",
       "}\n",
       "\n",
       "// Register the function which deals with the matplotlib target/channel.\n",
       "// The kernel may be null if the page has been refreshed.\n",
       "if (IPython.notebook.kernel != null) {\n",
       "    IPython.notebook.kernel.comm_manager.register_target('matplotlib', mpl.mpl_figure_comm);\n",
       "}\n"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<img src=\"\" width=\"639.9999861283738\">"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "\n",
    "basin=6\n",
    "for count, model in enumerate([models[0], models[1]]):\n",
    "\n",
    "    fig, hax = plt.subplots(1, len(epochs), gridspec_kw = {'wspace':0, 'hspace':0})\n",
    "\n",
    "    fig.suptitle(model+' '+str(h_range), fontsize=12)\n",
    "\n",
    "    for col, epoch in enumerate(epochs):\n",
    "\n",
    "        V = pd.DataFrame({ \"raw_data\" : dh_hist[model]['raw_data'][epoch],\\\n",
    "                          \"corr_data\" : dh_hist[model]['corr_data'][epoch]})\n",
    "        V = V.stack().reset_index()\n",
    "        V = V.drop(columns=['level_0'])\n",
    "        V.columns = ['htype','dh']\n",
    "\n",
    "        sns.violinplot(x=[epoch[:7]+'\\n'+epoch[7:]]*len(V), y='dh', data=V,\n",
    "                  scale='count', bw=0.05,\n",
    "                  hue='htype', split=True,\n",
    "                  palette='RdGy',\n",
    "                  inner='quartile',\n",
    "                ax=hax[col])\n",
    "\n",
    "        hax[col].set_ylim([-2, 2])\n",
    "        hax[col].legend_.remove()\n",
    "        if col != 0:\n",
    "            hax[col].set_ylabel('')\n",
    "            hax[col].set_yticklabels([])\n",
    "\n",
    "\n",
    "    handles, labels = hax[0].get_legend_handles_labels()\n",
    "    fig.legend(handles, labels, \n",
    "               loc='lower center', bbox_to_anchor=(0.5, 0.1),\n",
    "               ncol=2, \n",
    "               facecolor='white', framealpha=1)\n",
    "\n",
    "    fig.tight_layout()\n",
    "    fig.subplots_adjust(top=0.93)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "[dh_hist[model]['raw_data'][epoch].shape,\n",
    "dh_hist[model]['corr_data'][epoch].shape]\n",
    "[model, epoch]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
